Maintain JQuery OnChange After A Replacewith
I have some code that grabs the first select on the page and clones it so that I can reset it later on if needed. mySelect = jQuery('select').get(0); origSelect = jQuery(mySelect).
Solution 1:
Pass a parameter true to the clone method.
origSelect = jQuery(mySelect).clone(true); //This will clone the select with data and events
or replace the innerHTMl of origSelect with that of mySelect.
jQuery(origSelect).html(jQuery(mySelect).html());
Solution 2:
Use $(mySelect).live('change', ...)
instead of $(mySelect).change(...)
.
Post a Comment for "Maintain JQuery OnChange After A Replacewith"