[jQuery] 如何根据名字来选取checkbox数组 -- How to get the array of checkbox via name

 

代码
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
var j = jQuery("input[name='diagnostic[]']").length;
jQuery(
"input[name='diagnostic[]']").each(function(e){
if(jQuery(this).attr("checked") == false)
j
--;
});
});
//Pay attention to the code marked with red color. After that, we can get that at least one checkbox is selected.
//
]]>
</script>

 

 

posted @ 2010-06-03 11:23  DavidHHuan  阅读(874)  评论(0编辑  收藏  举报