Moved jquery event handling to parent since hidden elements do not get events attached