Assign an action when a specific select value has been picked

[javascript]
$(‘#test’).change(function() {

if ($(‘#test’).val() == "bader") {

alert("bader");

}
else if ($(‘#test’).val() == "mido") {

alert("mido");

}
else
{
alert("nothing has been selected");
}

});?

/*add this to your html form
<select name="test" id="test">
<option value="">–</option>
<option value="bader">bader</option>
<option value="mido">mido</option>
</select>?
*/

/* try demo here
http://jsfiddle.net/T3tUq/198/
*/
[/javascript]

Leave a Reply