move on- handler to the end of tag