亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

jQuery表單對象屬性篩選選擇器

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

表單篩選選擇器的描述:

444.png


注意事項:

選擇器適用于復(fù)選框和單選框,對于下拉框元素, 使用 :selected 選擇器在某些瀏覽器中,選擇器:checked可能會錯誤選取到<option>元素,所以保險起見換用選擇器input:checked,確保只會選取<input>元素


繼續(xù)學(xué)習(xí)
||
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title></title> <style> input { display: block; margin: 10px; padding: 10px; } </style> <script src="http://code.jquery.com/jquery-3.1.1.min.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元素。 $('input:enabled').css("border", "2px groove red"); </script> <script type="text/javascript"> //查找所有input所有不可用的(被禁用的元素)input元素。 $('input:disabled').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>php</option> <option selected="selected">php中文網(wǎng)</option> <option>aaron</option> <option selected="selected">php自學(xué)教程</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>
提交重置代碼