jQuery :contains()
此選擇器匹配所有包含指定文字的元素。
jQuery1.14版本新增。
語法結構:
[JavaScript] 純文字檢視 複製程式碼jQuery( ":contains(text)" )
引數解析:
text: 用來查詢的一個文字字串,區分大小寫。
程式碼例項:
[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 () { $("li:contains('html')").css("color","blue") }) }) </script> </head> <body> <ul> <li>html專區</li> <li>div+css專區</li> <li>Jquery專區</li> <li>Javascript專區</li> <li>html5專區</li> </ul> <input type="button" value="檢視效果" id="bt" /> </body> </html>
將包含“html”的li元素文字顏色設定為藍色。
相關文章
- jQuery.contains()jQueryAI
- JavaScript contains()JavaScriptAI
- javascript contains方法JavaScriptAI
- sga contains infomation (71)AI
- a control file contains informationAIORM
- 轉:ArrayList:用Set代替containsAI
- 全文索引——CONTAINS 語法索引AI
- LeetCode-Contains Duplicate IILeetCodeAI
- java——ArrayList中contains()方法中的疑問JavaAI
- leetcode 219. Contains Duplicate IILeetCodeAI
- list is not in GROUP BY clause and contains nonaggre的問題AI
- [LintCode/LeetCode] Contains Duplicate IIILeetCodeAI
- Swift中使用Contains的正確姿勢SwiftAI
- [easy][Array][HashTable]219.Contains Duplicate IIAI
- 217. Contains Duplicate--LeetCode RecordAILeetCode
- contains a file system with errors, check forced解決方法AIError
- Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggreExpressAI
- 關於'CALayer position contains NaN: [nan nan]'異常AINaN
- LINQ系列:LINQ to SQL Exists/In/Any/All/ContainsSQLAI
- POXPOEPO Supplier Contact Field List Of Values Contains No EntriesAI
- 【AD報錯】GND contains Output Pin and Power Pin objectsAIObject
- C# 有關List<T>的Contains與Equals方法C#AI
- ORA-22868: table with LOBs contains segments in different tablespacesAI
- ORA-16025: contains repeated or conflictingAI
- ORA-03297: file contains used data beyond requested RESIZE valueAI
- ArrayList的contains方法與Object的equals方法的關係AIObject
- 00017: Data frame has at least one annotation group that is enabled and contains graphicsASTAI
- WPF custom control contains datagrid,listbox,imageAI
- jQuery初探:自制jQueryjQuery
- mysql報錯:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggreMySqlExpressAI
- List中對比Contains, Exists, Any之間的優缺點AI
- Android出現:Your project path contains non-ASCII characters.AndroidProjectAIASCII
- ORA-16025: contains repeated or conflicting attributesAI
- WP網站地圖XML報錯This page contains the following errors:網站地圖XMLAIError
- ef8 Contains 查詢條件 報錯 $ 附近錯誤AI
- 我的’jQuery’和jQueryjQuery
- 我的''jQuery''和jQueryjQuery
- 【Jquery】jquery 基本的動畫jQuery動畫