0

I have a small form with checkboxes inside of a Bootstrap popover, attached to a link inside a td element. I add an event handler with jQuery's .on() method, like this (simplified):

$('a').closest('td').on('change', 'input', doSomething);

The problem is, that doSomething() only triggers during the first appearance of the popover. When I close it and re-open it, doSomething() does not trigger anymore.

rausch
  • 3,148
  • 2
  • 18
  • 27
  • 2
    It sounds like the `td` you're binding the handler to is getting recreated and the handler is getting lost. Try binding to an element higher in the dom tree that you are sure isn't being changed, maybe even the document. – Jason P Oct 29 '13 at 17:30
  • Can you show at least the partial HTML for the ``? – glomad Oct 29 '13 at 17:31
  • If the `td` is being replaced this will only work once - see http://stackoverflow.com/questions/1359018/in-jquery-how-to-attach-events-to-dynamic-html-elements – andyb Oct 29 '13 at 17:32

0 Answers0