Option default Selected Example : Option Select ComboBox : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » Option Select ComboBox »

 

Option default Selected Example



    
<html>
<body>
<form id="myForm"><select name="select">
    <option value="1">Item 1</option>
    <option value="2">Item 2</option>
    <option id="o3" value="3">Default selected Option</option>
    
<script language="JavaScript">
    document.getElementById("o3").defaultSelected = true;
    var n = document.getElementById("o3").innerText;
    function function1() {
        alert('Default selected Option label:n'+'"'+n+'"');
        document.getElementById("myForm").reset()
    
</script> 
    <option value="4">Item 4</option>
    <option value="5">Item 5</option>
</select>
</form>
<input type="button" value='Click here' onclick="function1();">
</body>
</html>

    
      
      



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» Option Select ComboBox