I want to be able to detect when the user has selected an option from a SELECT element in a form. I know what to do from there, but not sure about how to achieve the initial detection.
<select id="mySelect">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
I would like the solution in JQuery if possible.
You probably want the
.change()handler, like this:.val()gets the current value of the dropdown (as a string), just use that to do whatever you want, e.g.alert("The new value is: " + $(this).val());, etc.