求解 value="true" 的checkbox为什么不能选中

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js">

</head>
<body>
<div id="tabsList-3">
<input id = "1" type="checkbox" value="true" />
<input id = "2" type="checkbox" value="false" />
<input id = "3" type="checkbox" value="false" />
<input id = "4" type="checkbox" value="false" />
<input id = "5" type="checkbox" value="false" />
<input id = "6" type="checkbox" value="false" />
<input id = "7" type="checkbox" value="false" />
<input id = "8" type="checkbox" value="false" />
<input id = "9" type="checkbox" value="false" />

</div>
</body>
<script>
 $(document).ready(function(){
 $("#tabsList-3 input[type='checkbox']").each(function(){if ($(this).value == 

"true") {
                        $(this).attr("checked", true);}})

});

</script>
</html>
查看全部
woshiqianqu1
woshiqianqu1
2015/07/29 09:30
  • html5
  • checkbox
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

14个回复