<label><input id="IsProp" type="checkbox">需要试用</label>
<script>
$(function(){
//设置默认勾选
$("#IsProp").attr("checked", "checked");
//绑定单击事件
$("#IsProp").on("click", function () {
if ($(this).prop("checked")) {
alert("我被勾选了");
}
else {
alert("取消勾选");
}
});
});
</script>
checkbox单击事件,默认勾选
最新推荐文章于 2024-05-14 02:38:27 发布