|
| JAVASCRIPT ONCHANGE EVENT
The javascript onchange event handler is used to trigger a script or action when a user makes a content change to either <input>, <textarea> or <select> element.
Example:
<form action="#" method="post">
<select onchange="alert('You have made a change');">
<option select="selected">One</option>
<option >Two</option>
<option >Three</option>
</select>
</form>
The above example will output You have made a change when you select a new option.
The onchange event can also call a function as follows:
<head>
<script type="text/javascript">
function changeme ()
{
alert('You have made a change');
}
</script>
</head>
<body>
<form action="#" method="post">
<select onchange="changeme ();">
<option select="selected">One</option>
<option >Two</option>
<option >Three</option>
</select>
</form>
DEMO:
Change the select option below to see the effect.
See also:
|
|