I have a simple dropdown and want to get the specific value of an option if the user changes the dropdown selection, but without having him to push a submit button. Is this possible with jquery?
Here is what I got so far:
<form action='select.htm'>
<select id='BezirksAuswahl'>
<option value='Alle'>Alle Einträge</option>
<option value='Charlottenburg-Wilmersdorf'>Charlottenburg-Wilmersdorf</option>
<option value='Reinickendorf'>Reinickendorf</option>
</select>
</form>
and here the script:
$('#BezirksAuswahl').click(function(){
$('#BezirksAuswahl option:selected').each(function(){
alert($(this).val());
});
});
Thank you for your help and I am looking forward to your answers.
Use the
changeevent, which fires when the value of the element changes, like so: