62,046
社区成员
发帖
与我相关
我的任务
分享
$(document).ready(function() {
var lastDom = null;
$("input[type='checkbox']").bind("click", function() {
if (lastDom && lastDom.attr("id") != $(this).attr("id")) {
lastDom.attr("checked", false);
}
lastDom = $(this);
})
})
<script src="http://code.jquery.com/jquery-1.4.4.min.js" type="text/javascript"></script> <script type="text/javascript">
$(function() {
$("#checkAll").click(function() {
$("input[type='checkbox']").attr("checked",this.checked);
});
var $subBox = $("input[type='checkbox']");
$subBox.click(function(){
$("#checkAll").attr("checked",$subBox.length == $("input[type='checkbox']:checked").length ? true : false);
});
});
</script>