????:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Document</title><script src="./jquery-3.3.1.min.js"></script><script type
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="./jquery-3.3.1.min.js"></script>
<script type="text/javascript">
//表單選擇器
//語(yǔ)法
//$(':enabled')所有激活的input元素(可以使用的input元素)
//$(':disabled')所有禁用的input元素(不可以使用的input元素)
//$(':selected')所有被選取的元素,針對(duì)于select元素
//$(':checked')所有被選中的input元素
$(document).ready(function () {
// $(':enabled').css('background','pink')
// $(':disabled').css('background','red')
// $(':selected').css('color','blue')
$(':checked').parent().css('color','red')
})
</script>
</head>
<body>
<form action="">
輸入框1 <input type="text" name=""><br>
輸入框2 <input type="text" name=""><br>
輸入框3 <input type="text" name="" disabled=""><br>
輸入框4 <input type="text" name=""><br>
<select name="" id="">
<option value="">摩羯座</option>
<option value="" selected="">雙魚座</option>
<option value="">射手座</option>
<option value="">天蝎座</option>
</select><br>
愛(ài)好:
<label for=""><input type="checkbox" name="">看書</label>
<label for=""><input type="checkbox" name="" checked="">游泳</label>
<label for=""><input type="checkbox" name="">游戲</label>
</form>
</body>
</html>
?? ???:韋小寶?? ??:2019-03-07 09:13:33
???? ??:寫的很不錯(cuò) jQuery中的選擇器種類也是蠻多的 但是總的來(lái)說(shuō)選擇器都很重要 常用的也就id class 以及表單選擇器這幾種