abstrait:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>jquery表單選擇器</title> <script type="text/javascript" src="jquery-3.3.1.min.js&qu
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jquery表單選擇器</title> <script type="text/javascript" src="jquery-3.3.1.min.js"></script> <style type="text/css"> </style> </head> <body> <script type="text/javascript"> // 表單選擇器 // 語法: // $(':enabled')所有激活的input元素(可以使用的input元素) // $(':disabled')所有禁用的input元素(不可以使用的input元素) // $(':selected')所有被選取的元素,針對于select元素 // $(':checked')所有被選中的input元素 $(document).ready(function(){ $(':enabled').css('background','pink'); $(':disabled').css('background','blue'); $(':selected').css('color','blue'); $(':checked').parent().css('color','red'); }) </script> <form> 輸入1<input type="text" name=""><br> 輸入2<input type="text" name=""><br> 輸入3<input type="text" name=""><br> 輸入4<input type="text" name="" disabled><br> 輸入5<input type="text" name=""><br> <select> <option>摩羯座</option> <option selected>雙魚座</option> <option>射手座</option> <option>天蝎座</option> </select> <label><input type="checkbox" name="">1</label> <label><input type="checkbox" name=""checked>2</label> <label><input type="checkbox" name="">3</label> </form> </body> </html>
Professeur correcteur:查無此人Temps de correction:2019-02-22 16:18:34
Résumé du professeur:完成的不錯。下次把代碼縮進,看著整齊。jquery選擇器功能很強大,要多練習(xí),繼續(xù)加油。