本来直接用$(this).attr(“checked”)是能返回值true/false。
可是却来了个undefined
看元素才知道checkbox没有添加checked属性,可是已经选中了啊
看到https://blog.youkuaiyun.com/brucecheng22/article/details/50408199这个帖子才知道。用prop才能解决。
$(this).prop(“checked”)正常返回true/false
本来直接用$(this).attr(“checked”)是能返回值true/false。
可是却来了个undefined
看元素才知道checkbox没有添加checked属性,可是已经选中了啊
看到https://blog.youkuaiyun.com/brucecheng22/article/details/50408199这个帖子才知道。用prop才能解决。
$(this).prop(“checked”)正常返回true/false