jQuery選擇器之表單對象屬性篩選選擇器
除了表單元素選擇器外,表單對象屬性篩選選擇器也是專門針對表單元素的選擇器,可以附加在其他選擇器的后面,主要功能是對所選擇的表單元素進行篩選
表單篩選選擇器的描述:

注意事項:
- 選擇器適用于復(fù)選框和單選框,對于下拉框元素, 使用 :selected 選擇器
- 在某些瀏覽器中,選擇器:checked可能會錯誤選取到<option>元素,所以保險起見換用選擇器input:checked,確保只會選取<input>元素
任務(wù)
在代碼編輯器中第29行填寫相應(yīng)代碼
$('input:enabled')
在代碼編輯器中第34行填寫相應(yīng)代碼
$('input:disabled')
在代碼編輯器中第56行填寫相應(yīng)代碼
$('input:checked')
在代碼編輯器中第62行填寫相應(yīng)代碼
$('option:selected')
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" href="imooc.css" type="text/css">
<style>
input {
display: block;
margin: 10px;
padding: 10px;
}
</style>
<script src="http://idcbgp.cn/static/lib/jquery/1.9.1/jquery.js"></script>
</head>
<body>
<h2>子元素篩選選擇器</h2>
<h3>enabled、disabled</h3>
<form>
<input type="text" value="未設(shè)置disabled" />
<input type="text" value="設(shè)置disabled" disabled="disabled" />
<input type="text" value="未設(shè)置disabled" />
</form>
<script type="text/javascript">
//查找所有input所有可用的(未被禁用的元素)input元素。
?.css("border", "2px groove red");
</script>
<script type="text/javascript">
//查找所有input所有不可用的(被禁用的元素)input元素。
?.css("border", "2px groove blue");
</script>
<h3>checked、selected</h3>
<form>
<input type="checkbox" checked="checked">
<input type="checkbox">
<input type="radio" checked>
<input type="radio">
<select name="garden" multiple="multiple">
<option>imooc</option>
<option selected="selected">慕課網(wǎng)</option>
<option>aaron</option>
<option selected="selected">博客園</option>
</select>
</form>
<script type="text/javascript">
//查找所有input所有勾選的元素(單選框,復(fù)選框)
//移除input的checked屬性
?.removeAttr('checked')
</script>
<script type="text/javascript">
//查找所有option元素中,有selected屬性被選中的選項
//移除option的selected屬性
?.removeAttr('selected')
</script>
</body>
</html>
請驗證,完成請求
由于請求次數(shù)過多,請先驗證,完成再次請求