jQuery如何判断哪个select被选中
1个回答
展开全部
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8>
<title>Nothing</title>
<style type="text/css">
</style>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$ (function ()
{
alert ($("select:first option").is(":selected"));
alert ($("select:last option").is(":selected"));
});
</script>
</head>
<body>
<select multiple="multiple">
<optgroup label="阿全">
<option>红色的</option>
<option>起凡哪</option>
<option>拜啦帅哥</option>
</optgroup>
</select>
<select>
<option>111</option>
<option>222</option>
</select>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询