免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
jQuery選擇器使用方法簡介
1. [attribute]用法
定義:匹配包含給定屬性的元素
返回值:Array<Element>
參數(shù):attribute (String) : 屬性名
實例:將ID為"div_a1"的DIV中有ID屬性的span元素的背景色改為紅色
代碼: $("#div_a1 span[id]").css("background-color","red"); //點擊按鈕一將執(zhí)行這句代碼 DIV ID="div_a1"
span ID="span_1"
span 無ID屬性
span ID="span_2"
DIV ID="div_a5"
2. [attribute=value]用法
定義:匹配給定的屬性是某個特定值的元素
返回值:Array<Element>
參數(shù):attribute (String):屬性名 value (String):屬性值。引號在大多數(shù)情況下是可選的。但在遇到諸如屬性值包含"]"時,用以避免沖突。
實例:將ID為"div_b1"的DIV中name屬性值為chk_attribute_test的input元素的背景色改為紅色
代碼:$("#div_b1 input[name=chk_attribute_test]").css("background-color","red"); //點擊按鈕二將執(zhí)行這句代碼 DIV ID="div_b1"
radio name='rd'
radio name='rd'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
DIV ID="div_b5"
3. [attribute!=value]用法
定義:匹配給定的屬性是不包含某個特定值的元素
返回值:Array<Element>
參數(shù):attribute (String):屬性名 value (String):屬性值。引號在大多數(shù)情況下是可選的。但在遇到諸如屬性值包含"]"時,用以避免沖突。
實例:將ID為"div_c1"的DIV中name屬性值不是chk_attribute_test的input元素的背景色改為紅色
代碼:$("#div_c1 > input[name!=chk_attribute_test]").css("background-color","red"); //點擊按鈕三將執(zhí)行這句代碼 DIV ID="div_c1"
radio name='rd'
radio name='rd'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
DIV ID="div_c5"
注意:這里我用了'>',如果將'>'換成' ',則按鈕三的背景顏色也會變成紅色
4. [attribute^=value]用法
定義:匹配給定的屬性是以某些值開始的元素
返回值:Array<Element>
參數(shù):attribute (String):屬性名 value (String):屬性值。引號在大多數(shù)情況下是可選的。但在遇到諸如屬性值包含"]"時,用以避免沖突。
實例:將ID為"div_d1"的DIV中name屬性值以'txt'開頭的input元素的背景色改為紅色
代碼:$("#div_d1 > input[name^=txt]").css("background-color","red"); //點擊按鈕四將執(zhí)行這句代碼 DIV ID="div_d1"
radio name='rd'
radio name='rd'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
DIV ID="div_d5"
5. [attribute$=value]用法
定義:匹配給定的屬性是以某些值結(jié)尾的元素
返回值:Array<Element>
參數(shù):attribute (String):屬性名 value (String):屬性值。引號在大多數(shù)情況下是可選的。但在遇到諸如屬性值包含"]"時,用以避免沖突。
實例:將ID為"div_e1"的DIV中name屬性值以'list'結(jié)尾的input元素的背景色改為紅色
代碼:$("#div_e1 > input[name$=list]").css("background-color","red"); //點擊按鈕五將執(zhí)行這句代碼 DIV ID="div_e1"
checkbox name='chk_attribute_list'
radio name='rd'
radio name='rd'
checkbox name='chk_attribute_list'
checkbox name='chk_attribute_list'
checkbox name='chk_attribute_list'
checkbox name='chk_attribute_list'
DIV ID="div_e5"
6. [attribute*=value]用法
定義:匹配給定的屬性是以包含某些值的元素
返回值:Array<Element>
參數(shù):attribute (String):屬性名 value (String):屬性值。引號在大多數(shù)情況下是可選的。但在遇到諸如屬性值包含"]"時,用以避免沖突。
實例:將ID為"div_f1"的DIV中name屬性值包含'_'的input元素的背景色改為紅色
代碼:$("#div_f1 > input[name*=_]").css("background-color","red"); //點擊按鈕六將執(zhí)行這句代碼 DIV ID="div_f1"
radio name='rd'
radio name='rd'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
checkbox name='chk_attribute_test'
DIV ID="div_f5"
7. [selector1][selector2][selectorN]用法
定義:復合屬性選擇器,需要同時滿足多個條件時使用。
返回值:Array<Element>
參數(shù):selector1 (Selector):屬性選擇器 selector2 (Selector):另一個屬性選擇器,用以進一步縮小范圍 selectorN (Selector):任意多個屬性選擇器
實例:將ID為"div_g1"的DIV中有id屬性且name屬性值以'rd'開頭和以'test'結(jié)尾的input元素的背景色改為紅色
代碼:$("#div_g1 > input[id][name$=test][name^=rd]").css("background-color","red"); //點擊按鈕七將執(zhí)行這句代碼 DIV ID="div_g1"
radio id='rd_0' name='rd_test'
radio id='rd_1' name='rd_test'
checkbox id='chk_0' name='chk_attribute_test'
checkbox id='chk_1' name='chk_attribute_test'
checkbox id='chk_2' name='chk_attribute_test'
checkbox id='chk_3' name='chk_attribute_test'
checkbox id='chk_4' name='chk_attribute_test'
DIV ID="div_g5"
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
jQuery 中,函數(shù) attr 與 prop 間的區(qū)別
Jquery主要控件的取值、賦值,包括textbox,button,lable,radio,checkbox,selected
jQuery的一些備忘
鋒利的jQuery學習筆記(3)
Jquery 選擇器
jQuery獲取attr()與prop()屬性值的方法及區(qū)別介紹
更多類似文章 >>
生活服務
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服