Whing Dela Cruz
asked on
Do alert on select
Hi experts, I wish to have an alert in every time i do select. As the code shown below.. Thanks!
<!DOCTYPE html>
<html>
<body>
<form>
<select name="cars">
<option value="volvo">Volvo</optio n>
<option value="saab">Saab</option>
<option value="fiat" selected>Fiat</option>
<option value="audi">Audi</option>
</select>
</form>
<script>
function iSelect()
{
alert is here...
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<form>
<select name="cars">
<option value="volvo">Volvo</optio
<option value="saab">Saab</option>
<option value="fiat" selected>Fiat</option>
<option value="audi">Audi</option>
</select>
</form>
<script>
function iSelect()
{
alert is here...
}
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I change the alert(x) to alert(x.value) and now its working. Thank you!
You're welcome!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot both of you guys!
ASKER
<form>
<select name="cars" onchange="iSelect(this)";>
<option value="volvo">Volvo</optio
<option value="saab">Saab</option>
<option value="fiat" selected>Fiat</option>
<option value="audi">Audi</option>
</select>
</form>
<script>
function iSelect(x)
{
alert(x)
}
</script>