<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="content-type" content="text/html; charset=UTF-8">
<script src="js/jquery-1.8.2.js"></script>
</head>
<body>
<div style="width: 90%;height: 20px;padding-left: 5%;">
<label>测试</label>
<input type="checkbox" id="testCheckbox">
</div>
<button style="margin: 10px 40%;width: 100px;">测试</button>
</body>
<script type="text/javascript">
(function(){
$("button").on("click",function(){
var flag = $("#testCheckbox").is(":checked");
if(flag){
$("#testCheckbox").prop("checked",0);
}else{
$("#testCheckbox").prop("checked",1);
}
});
})();
</script>
</html>
js设置单选框选中,取消
最新推荐文章于 2025-04-10 18:08:14 发布