Javascript examples for DOM:Node
Node firstChild Property - Get the text of the first child node of a <select> element:
<!DOCTYPE html> <html> <body> <select id="mySelect" size="4"> <option>Java</option> <option>SQL</option> <option>HTML</option> <option>CSS</option>< /select> <br><br> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w . j av a 2s. c o m var x = document.getElementById("mySelect").firstChild.text; document.getElementById("demo").innerHTML = x; } </script> </body> </html>