Javascript examples for DOM:Event
Handle change event on <select> element
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function myFun(sel)/*from w ww . java2 s.c o 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>