小问题苦恼了很久。 我开始是通过 $("input[name=xxx]").attr('checked',true); 来设置是否选中的,各种不好用,明明页面的代码已经是checked=checked了,就是不显示勾选。 百思不得其解。。。 后来在网上找到了答案 if(dataBack.remind){ $("#isremind").prop("checked",true); }else{ $("#isremind").removeAttr("checked"); } 添加的时候用prop,取消用removeAttr。 问题解决了。
---------------------------------------------------------------------------
checkbox 判断选中
if ($("#is_show").is(':checked')) { }