1 * $("*") 全部元素 2 #id $("#lastname") id="lastname" 的元素 3 .class $(".intro") 全部 class="intro" 的元素 4 element $("p") 全部 <p> 元素 5 .class.class $(".intro.demo") 全部 class 具備 "intro" 且 "demo" 的元素 6 s1,s2,s3 $("th,td,.intro") 全部帶有匹配選擇的元素 7 8 :even $("tr:even") 全部偶數 <tr> 元素 9 :odd $("tr:odd") 全部奇數 <tr> 元素 10 :first $("p:first") 第一個 <p> 元素 11 :last $("p:last") 最後一個 <p> 元素 12 13 :eq(index) $("ul li:eq(3)") 列表中的第四個元素(index 從 0 開始) 14 :gt(index) $("ul li:gt(3)") 列出 index 大於 3 的元素 greater than 15 :lt(index) $("ul li:lt(3)") 列出 index 小於 3 的元素 less than 16 :not(selector) $("input:not(:empty)") 全部不爲空的 input 元素 17 18 :header $(":header") 全部標題元素 <h1> - <h6> 19 :animated $(":animated") 全部正在執行動畫的元素 20 21 :contains(text) $(":contains('W3School')") 包含指定字符串的全部元素 22 :empty $(":empty") 無子(元素)節點的全部元素 23 :hidden $("p:hidden") 全部隱藏的 <p> 元素 24 :visible $("table:visible") 全部可見的表格 25 26 [attribute] $("[href]") 全部帶有 href 屬性的元素 27 [attribute=value] $("[href='#']") 全部 href 屬性的值等於 "#" 的元素 28 [attribute!=value] $("[href!='#']") 全部 href 屬性的值不等於 "#" 的元素 29 [attribute$=value] $("[href$='.jpg']") 全部 href 屬性的值包含以 ".jpg" 結尾的元素 30 31 :input $(":input") 全部 <input> 元素 32 :text $(":text") 全部 type="text" 的 <input> 元素 33 :password $(":password") 全部 type="password" 的 <input> 元素 34 :radio $(":radio") 全部 type="radio" 的 <input> 元素 35 :checkbox $(":checkbox") 全部 type="checkbox" 的 <input> 元素 36 :submit $(":submit") 全部 type="submit" 的 <input> 元素 37 :reset $(":reset") 全部 type="reset" 的 <input> 元素 38 :button $(":button") 全部 按鈕元素(<button></button> 或者 input="button") 39 :image $(":image") 全部 type="image" 的 <input> 元素 40 :file $(":file") 全部 type="file" 的 <input> 元素 41 42 :enabled $(":enabled") 全部激活的 input 元素 43 :disabled $(":disabled") 全部禁用的 input 元素 44 :selected $(":selected") 全部被選取的 input 元素 45 :checked $(":checked") 全部被選中的 input 元素 46 47 關係---------------------------------------- 48 $(selector).parent(); //獲取直接父級 49 $(selector).parents('p'); //獲取全部父級元素直到html 50 51 $(selector).children(); //獲取直接子元素 52 $(selector).find("span||class"); //獲取全部的後代元素 find方法 可能用的多。 53 54 $(selector).siblings() //全部的兄弟節點 55 $(selector).next() //下一個兄弟節點 56 $(selector).nextAll() //後面的全部節點 57 $(selector).prev() //前面一個的兄弟節點 58 $(selector).prevAll() //前面的全部的兄弟節點 59 60 $("p").eq(1); //取第n個元素 61 $("div p").last(); //取最後一個元素 62 $("div p").first(); //取第一個元素 63 $("p").filter(".intro"); //過濾,選擇全部p標籤帶有 .intro類 64 $("p").not(".intro"); //去除,跟上面的filetr正好相反