C. Hediger C. Hediger - 1 year ago 75
HTML Question

jquery mobile slider change does not generate an action

I am new to jquery and jquery mobile.
Actually i try to create a website which includes some jquery mobile elements
especially slider elements.

Now i would like to send an GET Request to a remote server each time the slider has changed. For this, i first tried to get an event after the slider has got changed. But i already strugeling with get this working properly.

I found this link: Jquery Mobile Slider change event basically this is exactly what i want to do. But i was not able to get it working. There is something i must have overseen.

Here is my tryit script: http://www.w3schools.com/code/tryit.asp?filename=FA32UJH5J6YJ

The alert box never popsup.

I would be very happy, if someone with more experience could take a look at the script and tell me what i did wrong.


Answer Source

Short answer: it does work, but you copied and pasted some Angular things in there as well. Here is a snippet of the barebones solution.

	var sliderValue = $('#slider').val();
  alert(`The slider value changed, the current value is: ${sliderValue}`);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='slider-wrapper'>
  <input type='range' id='slider' />

also, the JQuery versions you are using are way out of date. Try updating to a newer version.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download