<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
</head>
<body>
<select id="select">
<option value="1">a</option>
<option value="2" >b</option>
</select>
<script type="text/javascript">
var value=jQuery("#select option:selected").text();
$("#select").bind("change",function(){alert(value);})
</script>
</body>
</html>
为什么我选什么都输出a

解决方案 »

  1.   


    $("#select").bind("change",function() {
    alert($(this)[0].value);
    });
      

  2.   

    谢谢 我要去系统补习一下js和dom的东西。
      

  3.   

    $("#select").change(function(){
              alert($(this).val() );    
       });
      

  4.   

    问一下,如果我就是要得当前option的变量呢
      

  5.   

    $(document).ready(function()
    {
     $("#select").change(function()
     {
             var selected= $("#select option:selected").text();;

               alert(selected);
     });
    })
    </script>
    </head>
     <body>
     <select id="select">
     <option value="1">a</option>
     <option value="2">b</option>
     </select>