<select> change event - Javascript jQuery

Javascript examples for jQuery:Select Dropdown

Description

<select> change event

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script> 
  <script language="javascript">
    $(document).ready(function(){
        $('#myoption').change(function() { console.log('Select Dropdown was clicked: '+ $('#myoption').val()); });
    });//  w w w  .  j  a  v  a2s  . com
    
      </script> 
 </head> 
 <body> 
  <select id="myoption"> <option value="A">A</option> <option value="B">B</option> </select>  
 </body>
</html>

Related Tutorials