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

jQuery form object property filter selector

In addition to the form element selector, the form object attribute filter selector is also a selector specifically for form elements. It can be appended to other selectors. Its main function is to filter the selected form elements.

Description of form filter selector:

444.png


Notes:

The selector applies to check boxes and single For select boxes, for drop-down box elements, use the :selected selector. In some browsers, the selector :checked may mistakenly select the <option> element, so to be on the safe side, use the selector input:checked to ensure that only the <option> element is selected. <input>Element


Continuing Learning
||
<!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>
submitReset Code