JQ ie全选复选框正常,FF下只显示一次! 本帖最后由 net_lover 于 2013-12-21 21:14:59 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $('label').click改成$('.box-all').change 你什么版本的浏览器啊?我FF,ie8都通过测试 <!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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="x-ua-compatible" content="ie=7" /><title>test page</title><script language="javascript" type="text/javascript" src="./plugins/jq1.10.2.js"></script><script language="javascript" type="text/javascript">$(document).ready(function(){ $('label').click(function(){ $(".box-items").each(function(){ alert($(".box-all").attr("checked")); $(this).attr("checked",!!$(".box-all").attr("checked")); }); });})</script></head><body><label><input type="checkbox" class="box-all" /><span>全选</span></label><br><input type="checkbox" class="box-items"/><br><input type="checkbox" class="box-items"/><br><input type="checkbox" class="box-items"/><br><input type="checkbox" class="box-items"/><br><input type="checkbox" class="box-items"/><br></body></html>Firefox 26.0IETester 操作系统是XP SP3测试都弹出5个undefined 你什么版本的浏览器啊?我FF,ie8都通过测试Firefox 26.0 IETester 都没测试通过! 我在网上也查到这种写法,但都没有测试成功,不知道是什么原因?后来自己参考别人的思路重写了代码后IE下是好的。但FF下多次点击却只显示一次全选状态,获取checked的值已被改变显示却没有改变。 麻烦帮我分析下,谢谢! 完整的测试代码<script src="jquery-1.10.2.min.js"></script><script>$(function(){$('label').click(function(){$(".box-items").each(function(){ $(this).prop("checked",!!$(".box-all").prop("checked"));});});});</script><label><input type="checkbox" class="box-all" /><span>全选</span></label><br><input type="checkbox" class="box-items"/><br><input type="checkbox" class="box-items"/><br><input type="checkbox" class="box-items"/><br><input type="checkbox" class="box-items"/><br><input type="checkbox" class="box-items"/><br>注意jquery版本 请问元素对象的事件名是否可写成变量,火狐可以,不知道ie如何写 iframe 跳转问题 这怎么做啊 使用jquery遇到的问题 怎么让input的title显示的是input的value值 求助:关于递归算法 谁能给我个JS的UBB替换函数? 怎样实现,在提交表单时弹出个警告窗口,如果选择"是"则提交表单如果选择"否"则什么都不发生 求一段实现滚动新闻栏的java代码 obj怎么生成一个newObj 【求助】复选框的嵌套功能 JQ DIV增加属性
改成
$('.box-all').change
你什么版本的浏览器啊?我FF,ie8都通过测试
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=7" />
<title>test page</title>
<script language="javascript" type="text/javascript" src="./plugins/jq1.10.2.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$('label').click(function(){
$(".box-items").each(function(){
alert($(".box-all").attr("checked"));
$(this).attr("checked",!!$(".box-all").attr("checked"));
});
});
})</script>
</head>
<body>
<label><input type="checkbox" class="box-all" /><span>全选</span></label><br>
<input type="checkbox" class="box-items"/><br>
<input type="checkbox" class="box-items"/><br>
<input type="checkbox" class="box-items"/><br>
<input type="checkbox" class="box-items"/><br>
<input type="checkbox" class="box-items"/><br></body>
</html>Firefox 26.0
IETester
操作系统是XP SP3
测试都弹出5个undefined
你什么版本的浏览器啊?我FF,ie8都通过测试Firefox 26.0 IETester 都没测试通过!
我在网上也查到这种写法,但都没有测试成功,不知道是什么原因?后来自己参考别人的思路重写了代码后IE下是好的。但FF下多次点击却只显示一次全选状态,获取checked的值已被改变显示却没有改变。 麻烦帮我分析下,谢谢!
$(function(){
$('label').click(function(){
$(".box-items").each(function(){
$(this).prop("checked",!!$(".box-all").prop("checked"));
});
});
});
</script><label><input type="checkbox" class="box-all" /><span>全选</span></label><br>
<input type="checkbox" class="box-items"/><br>
<input type="checkbox" class="box-items"/><br>
<input type="checkbox" class="box-items"/><br>
<input type="checkbox" class="box-items"/><br>
<input type="checkbox" class="box-items"/><br>注意jquery版本