jquery1.9.1 checked 全选
$(function() { $("#checkAll").click(function(){ $("input[name='subBox']").removeAttr("checked"); //移除属性checked $("input[name='subBox']").prop('checked',true); }); $("#cancelAll").click(function(){ //$(":checkbox").removeAttr("checked"); //移除属性checked $("input[name='subBox']").prop('checked',false); }); });
早期版本中checked选中都是$("input[type='checkbox']").attr('checked',true);jQuery1.9.1版本的checkbox的checked方法更新成$("input[type='checkbox']").prop('checked',true);
posted on 2013-04-23 10:27 restService 阅读(349) 评论(0) 编辑 收藏 举报