in my app I receive data through websockets, depending on this data I want to append some sliders to my page content: . It is an array of objects I receive and for each object I want to create the corresponding slider with max, min, and the current value. Also I want an on change listener for each slider to send values back via websockets if the user changes the values.
I already stumbled upon this JQuery Mobile sliders inserted dynamically . But the solution doesn't seem appropriate because the elements should be created on runtime, and not when the page is loaded the first time. Moreover I don't know, how to set the onchange listeners in an elegant way.
Preferably I would like to use Jquery Mobile as I already use it for the other visual elements but if it is not possible I would be thankful for any other possibility.
Edit: And how can i refer to the index of the array within my onchange listener I tried ($(this).id()) but this throws: "TypeError undefined is not a function".
Thanks Peter.