JavaScript Tutorial

adplus-dvertising
Onselect event In JavaScript
Previous Home Next

javascript is used Onselect event for used a specific text or field

Syantax :

element.onselect=function(){myScript};

Example :

<head>
    <script type="text/javascript">
        function OnSelectionChange (select) {
            var selectedOption = select.options[select.selectedIndex];
           
              
}
 
    </script>
</head>
<body>
    Select an item from the following list:<br />
    <select onchange="OnSelectionChange (this)">
        <option value="BIKE" />BIKE
        <option value="TRAIN" />TRAIN
        <option value="AEROPLAIN" />AEROPLAIN
    </select>
</body>

Output :

Previous Home Next