lundi 24 mars 2014

How to handle dynamically added DOM elements in progressive enhancement?


Vote count:

0




I have a simple text input that is "progressively enhanced" with a draggable slider (demo of the jQuery plugin here.


Additional <input> elements may be added, and the whole thing will be placed in many different scenarios (it's a pluggable frontend widget). In other words, I cannot hook onto some "Add Another Slider" button's click event, because I have no idea where those additional elements may come from (it may be a button, several buttons, some AJAX call, etc).


To handle those additional elements, currently I'm using:



// for any dynamically added elements:
setInterval(find_and_init_all_sliders_that_are_not_yet_inited, 200);


Is there a better way?



asked 38 secs ago

frnhr

2,155





Aucun commentaire:

Enregistrer un commentaire