Skip to content Skip to sidebar Skip to footer

Modal Windows And Binding/unbinding

I have a modal window that pops up when a 'Add New' is selected from the a dropdown. The user can type in a text field a new option to be added to the dropdown. It works fine as

Solution 1:

You need to bind the event handler to something that doesn't get replaced in the DOM, ie <body>:

$(document.body).on('click', '#someElement', function() {
    // do something
});

You could also bind to another parent tag that you know won't get replaced.

http://api.jquery.com/on/


Post a Comment for "Modal Windows And Binding/unbinding"