I made a jquery function that binds some fields, but it doesn't work when i add a new inline.
The main problem is that i don't know how to detect the insertion in DOM and bind it to my function.
Thanks
I made a jquery function that binds some fields, but it doesn't work when i add a new inline.
The main problem is that i don't know how to detect the insertion in DOM and bind it to my function.
Thanks
Use the live
or delegate
functions to bind to form elements. They will continue working even after you insert new form elements, and you don't need to re-attach the event handlers every time.
Related questions:
$('.add-row a').click(my_function)
as long as my_function does not include "return false;" it shouldn't interfere with the existing functionality of that button