jQuery [attribute]
此選擇器能夠匹配帶有給定屬性的元素。
jQuery1.0版本新增。
語法結構:
[JavaScript] 純文字檢視 複製程式碼$("[attribute]")
程式碼例項:
[HTML] 純文字檢視 複製程式碼執行程式碼<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#bt").click(function(){ $("[title]").css("color","blue"); }); }); </script> </head> <body> <ul> <li>螞蟻部落一</li> <li title="ant_1">螞蟻部落二</li> </ul> <input type="button" value="檢視效果" id="bt"/> </body> </html>
將具有title屬性的li元素字型顏色設定為藍色。
相關文章
- jQuery [attribute*=value]jQuery
- jQuery [attribute~=value]jQuery
- jQuery [attribute|=value]jQuery
- jQuery [attribute$=value]jQuery
- jQuery [attribute^=value]jQuery
- jQuery [attribute!=value]jQuery
- jQuery [attribute=value]jQuery
- Attribute Checks
- 理解Spring MVC Model Attribute和Session AttributeSpringMVCSession
- ERROR getting 'android:label' attribute: attribute is not a string valueErrorAndroid
- C# 特性[Attribute]C#
- C#-特性(Attribute)C#
- 理解C# AttributeC#
- According to TLD or attribute directive in tag file, attribute value does not accept any expressionExpress
- Process object has no attribute '_popen'Object
- ‘dict‘ object has no attribute ‘iteritems‘Object
- selenium get_attribute
- Max length of title attribute in htmlHTML
- attribute和property區別
- __attribute__((packed)) 詳解
- Property 與 Attribute 區別
- get_attribute ('textContent') 和 get_attribute ('value') 有什麼區別
- C# 中的特性 AttributeC#
- property和attribute的區別?
- attribute和property的區別
- html tags and attribute集參考HTML
- ‘FirewallD‘ object has no attribute ‘path‘ 、‘fw‘、is not registeredObject
- Entity Framework 6.0 Tutorials(10):Index AttributeFrameworkIndex
- AttributeError: 'module' object has no attribute 'lock'ErrorObject
- ORA-29786: SIHA attribute GET failedAI
- According to TLD or attribute directive in tag file, attribute value does not accept any expressions報錯解決辦法Express
- 使用JSTL庫的時候: According to TLD or attribute directive in tag file, attribute value does not accept anyJS
- 使用TypeDescriptor給類動態新增Attribute
- 向Vertex Shader傳遞vertex attribute
- module ‘h5py‘ has no attribute ‘File‘H5
- 【坑】Tkinter ‘NoneType‘ object has no attribute ‘destroy‘NoneObject
- AttributeError: module ‘requests‘ has no attribute ‘_version_‘Error
- AttributeError: 'Settings' object has no attribute 'HBase'ErrorObject