jQuery中的prop的方法
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>prop</title>
</head>
<body>
<input type="button" value="选中">
<input type="button" value="不选中">
<input type="checkbox" id="ck">
<script src="jquery-1.12.4.js"></script>
<script>
//对于布尔类型的属性,不要attr方法,应该用prop方法 prop用法跟attr方法一样。
$("input").eq(0).click(function(){
$("input").eq(2).prop("checked",true);
});
$("input").eq(1).click(function(){
$("input").eq(2).prop("checked",false);
});
</script>
</body>
</html>


浙公网安备 33010602011771号