Jquery UI slider ... create sliders dynamically (fiddle inside)

Hi,

I am using a jquery ui slider on a website, and the thing is there can be multiple sliders with the same classname on the page, they are added dynamically. If I have two sliders on the page, dragging the handle of one changes the value of both. Does anyone know how I could edit the code below so dragging the handle only affects the one? (I am a js/jquery beginner still)

FIDDLE: http://jsfiddle.net/0Lqw0bgx/53/

You will need to either have different class names or reference unique ids

Do you know if this would be possible to do dynamically?

possible, but I don’t know how, sorry. I would start looking at this - they are creating inputs with dynamically assigned ids
http://stackoverflow.com/questions/19994281/use-javascript-to-create-dynamic-input-id

or allow for a new div per slider and reference the div id…this should help also
http://stackoverflow.com/questions/3319683/add-id-to-dynamically-created-div

and 1 more…this looks nice, clean and simple
http://stackoverflow.com/questions/3416227/create-dynamic-div-with-unique-ids-jquery

FIDDLE: http://jsfiddle.net/0Lqw0bgx/53/

This topic is now closed. New replies are no longer allowed.

Conversation continued at