<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
<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
$("#select").bind("change",function() {
alert($(this)[0].value);
});
alert($(this).val() );
});
{
$("#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>