Javascript examples for DOM HTML Element:Select
Select selectedIndex Property - Deselect all options:
<!DOCTYPE html> <html> <body> <select id="mySelect"> <option>CSS</option> <option>Javascript</option> <option>Database</option> <option>SQL</option> </select>/*from www . j a v a2s . c om*/ <p>Click the button to deselect options.</p> <button onclick="myFunction()">Test</button> <script> function myFunction() { document.getElementById("mySelect").selectedIndex = "-1"; } </script> </body> </html>