如何实时的把checkbox设成false 本帖最后由 molaifeng 于 2012-07-25 20:18:01 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $(document).ready( function() { $("input[name='ck[]']").click( function() { var o = $("input[name='ck[]']"); if (o.filter(":checked").length == 3) o.not(":checked").attr("disabled", "disabled"); else o.not(":enabled").removeAttr("disabled"); });});复选框name属性值改为ck[] $(function () { $('input[name="ck"]').click(function() { if($('input[name="ck"]:checked').size()==3)$('input[name="ck"]').not(':checked').attr('disabled',true); else $('input[name="ck"]:disabled').attr('disabled',false); })}) $(function () { $('input[name="ck"]').change(function() { var count = 0; $('input[name="ck"]').each(function () { if($(this).attr('checked') == true){ count++; } if(count == 3){ $('input[name="ck"]').each(function () { if($(this).attr('checked') == false){ $(this).attr('disabled',true); } }) } else if(count <= 2) { $('input[name="ck"]').each(function () { if($(this).attr('disabled') == true){ $(this).attr('disabled',false); } }) } }) })})刚刚自己又写了下,可以完成,不过方法太笨,有简化的么 浮动层+lightbox而已,参考lightbox实现的checkbox联动 DOM认style属性吗? 请问关闭浏览器的时候触发事件怎么写呢?兼容各大浏览器 关于密码登陆时候怎么做到输入时候,显示最后一位? 怎么样为从数据库中的内容自动生成HTML页面 求一段JS验证时间格式代码 高分求解简单应用代码分析. 请...问.....表格线时有时无, 为啥. 如何用JS来刷新用脚本写出的新生成的页面 框架问题 请问做系统分析方面的工作要看哪方面的书和资料? 怎么用javascript弹出警告框 【紧急求助】JS如何取两个数组 不相同的值 关于easy-ui 中的treeGrid的数据显示问题
$("input[name='ck[]']").click( function() {
var o = $("input[name='ck[]']");
if (o.filter(":checked").length == 3) o.not(":checked").attr("disabled", "disabled");
else o.not(":enabled").removeAttr("disabled");
});
});复选框name属性值改为ck[]
$('input[name="ck"]').click(function() {
if($('input[name="ck"]:checked').size()==3)$('input[name="ck"]').not(':checked').attr('disabled',true);
else $('input[name="ck"]:disabled').attr('disabled',false);
})
})
$(function () {
$('input[name="ck"]').change(function() {
var count = 0;
$('input[name="ck"]').each(function () {
if($(this).attr('checked') == true){
count++;
}
if(count == 3){
$('input[name="ck"]').each(function () {
if($(this).attr('checked') == false){
$(this).attr('disabled',true);
}
})
}
else if(count <= 2) {
$('input[name="ck"]').each(function () {
if($(this).attr('disabled') == true){
$(this).attr('disabled',false);
}
})
}
})
})
})刚刚自己又写了下,可以完成,不过方法太笨,有简化的么