I have a page where I dynamically add in divs, as such:
$(divCol).insertAfter(parentNewRow.children('.edCol:last'));
This inserts another duplicate div after the last .edCol div. Everything works well, except for the fact that with the new .edCol div, none of the buttons work anymore. All the jQuery functions that work perfectly on the original div now do nothing. The code is identical in the new div, all the classes are the same etc, yet nothing works.
Clearly I am missing something. Can anyone shed any light on this? Any help would be much appreciated.
jQuery documentation indicates
live()is deprecated you should use theon()function.Here’s an example that you can see working in this fiddle.
And the HTML that goes with it:
EDIT
Please check out the following fiddle that’s a more complete example and will probably clarify your doubts about how the
on()method is used: DEMO.HTML
JS