Drop down listbox onChange event
JavaScript
JS Validation Listbox
We can read the selected option of a drop down list box by using onChange event trigger. The onChange event will trigger one JavaScript function and we will try to read the selected item by using getElementById
<select id=s1 name=no_year onChange="show_date()";>
....
</select>
Demo of OnChange Listbox →
Here is the code
<html>
<head>
<title>Demo Project on JavaScript listbox onChange</title>
</head>
<script type="text/javascript">
function show_date(){
document.getElementById("msg3").innerHTML= document.getElementById("s1").value;
return true;
}
</script>
</body>
<body>
<select id=s1 name=no_year onChange="show_date()";>
<option value=Jan>January</option>
<option value=Feb>February</option>
<option value=March>March</option>
<option value=April>April</option>
<option value=May>May</option>
</select>
<div id='msg3'></div>
</body>
</html>
OnChange event of dropdown list box to trigger a function to reload the page with selected data
VIDEO
Selection of Multiple selection listbox →
← Listbox
Adding option to Listbox →
← JavaScript Validation
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
plus2net.com