I’m trying to do a simple alert when the value is changed, but the value of the select element is changed with an slider so onchange isn’t working. How can I listen for the value change and alert new value using javascript or jquery?
<select name="speed" id="speed" onchange="alert(this.value)">
<option value="10mi">less than 10 miles</option>
<option value="20mi">less than 20 miles</option>
<option value="40mi" selected="selected">less than 40 miles</option>
<option value="60mi">less than 60 miles</option>
<option value="Off">Off</option>
</select>
You need to listen to the slider change.
Reference: http://jqueryui.com/demos/slider/#event-change
When you change the textbox value with JS, it doesn’t trigger the change event. It may be a similar case with the dropdown, that’s why you’ll have to handle it on the side that triggered it.