美文网首页
checked 选中状态

checked 选中状态

作者: 洱月 | 来源:发表于2018-05-14 15:00 被阅读0次

//判断checkbox 是否选中
$("#id").is(":checked");//选中,返回true,没选中,返回false

//设置checkbox为选中状态
$("#id").prop("checked",true);

//设置checkbox为不选中状态
$("#id").prop("checked",false);

//获取页面选中的元素
var arr = [];
$(".label_list input:checked").each(function () {
arr.push($(this).attr('id'))
})

相关文章

网友评论

      本文标题:checked 选中状态

      本文链接:https://www.haomeiwen.com/subject/lsfjdftx.html