javascript - How to handle dynamically-added DOM elements for progressive enhancement without knowing the method of adding? -


i have simple script that "progressively enhances" specific <input> elements draggable slider (demo of jquery plugin).

additional <input> elements may added, , whole thing placed in many different scenarios (it's pluggable frontend widget). in other words, cannot hook onto "add slider" button's click event, because have no idea additional elements may come (it may button, several buttons, ajax call, etc).

to handle additional elements, i'm using:

// dynamically added elements: setinterval(find_and_init_all_sliders_that_are_not_yet_inited, 200);   

is there better way?


tl;dr:

i wanna run function each time new dom elements added. have no info or control on how or new elements added.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -