Javascript examples for DOM HTML Element:Select
Get last selected listbox item in javascript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function myFun(sel)/*from w w w .jav a 2 s. co m*/ { console.log(sel.options[sel.selectedIndex].value); } </script> </head> <body> <select multiple onchange="myFun(this);"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="opel">Opel</option> <option value="audi">Audi</option> </select> </body> </html>