jQuery mobile, range slider and slidestop event
Good day,
I was trying for a while to get the slidestop event to fire with HTML code like so:
- <label for="tempslider">Temperature</label>
- <input type="range" name="tempslider" id="tempslider" value="95" min="90" max="135" />
and JS like:
- $("#tempslider").on("slidestop", function(event) {console.log("temp value stop at " + $(this).val() );});
But it simply would not fire. Finally I found a sample code snippet that used a variation of 'on' which attached to a parent object, like so:
- <div data-role="fieldcontain" id="warmtemp">
- <label for="tempslider">Temperature</label>
- <input type="range" name="tempslider" id="tempslider" value="95" min="90" max="135" />
- </div>
And then used JS like so:
- $("#warmtemp").on("slidestop", "#tempslider", function(event) {console.log("temp value stop at "+$(this).val());});
And this worked great!
So, the question: do we expect the former method to work? I have seen samples on jsfiddle which show it working, but I was unable to get it working in my jQuery mobile (iOS) application. In any case, I can now move forward but thought others might be able to learn from my experience.
Thank you,
Tyler