用 jquery 怎么得到被隐藏的 option 数量?
做了一下select 不知道怎么判断可见option的数量 高手赐教
2014-05-28 15:59
程序代码:<html>
<head>
<style type="text/css">
select{
border: 3px red solid;
padding: 5px;
width: 200px;
border-radius: 5px;
}
</style>
</head>
<body>
<select id="select">
<option value="1">11</option>
<option value="2">111</option>
<option value="3">123</option>
</select>
<script type="text/javascript">
(function(){
if (!document || !document.getElementById){
console.log("error 1");
return false;
}
var selectObj = document.getElementById("select");
if (!selectObj){
console.log("error 2");
return false;
}
document.write("<br/><b>" + selectObj.length + "</b>");
return true;
})();
</script>
</body>
</html>
2014-05-29 13:29
2014-05-29 13:30
2014-05-30 14:10
2014-05-30 14:11