jQuery 插件機制插件
jQuery.fn.extend(object)//$(.div). jQuery.extend(object)//$().
基礎語法code
$(select).action()
$("*") //All Select("*") $(".class") //Class Selector(".class") $("element") //Element Selector("element") $("#id") //ID Selector("#id") $("selector1,selector2,selectorN") //Multipe Selector("selector1,selector2,selector
$("[attribute='value']") //Has Attribute Selector[name='value'] $("[attribute*='value']") //Attribute Contains With Selector [name*='value'] $("[attribute|='value']") //Attribute Contains Prefix Selector [name|='value'] $("[attribute^='value") //Attribute Contains Starts With Select[name^='value'] $("[attribute$='value']") //Attribute Contains Ends With Selector[name$='value'] $("[attribute!='value']") //Attribute Not Equal Select [name!='value'] $("[attribute~='value']") //Attribute Contains Word Selector[name~='value'] 空格包含value $("[attribute1][attribute2][attributeN]") //Multipe Attribute Select [name="value"][name2="vlue2"]
$(":animated") //:animated querySelector $(":eq(index") //index正值(,要匹配元素的索引值,從零開始),負值從最後一個元素開始 $(":even") //偶數索引,零開始,024,odd奇數 $(":first") //第一個匹配的元素 $(":focus") //獲取焦點的元素 $(":header") //獲取標題元素h1,h2,h3 $(":last") //last Select $(":gt(index)") //大於 $(":lt(index)") //小於 $(":not(select)") //選擇全部不匹配
$(":nth-child(index/even/odd/equation)") $(":first-child") //夫級第一個子元素 $(":last-child") //夫級最後一個子元素 $(":first-of-type")