contains
UK[kən'teɪnz] US[kən'teɪnz]
vt. (the third person singular form of contain), include, accommodate
v.Contain; control (the third person singular of contain); restrain; contain
jquery contains selector syntax
Function: :contains selector selects elements that contain the specified string. The string can be text contained directly within the element, or contained within a child element. Often used in conjunction with other elements/selectors to select elements in a specified group that contain specified text (as in the example above).
Syntax: $(":contains(text)")
##Parameters: text Required. Specifies the text to be found.
jquery contains selector example
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p:contains(is)").css("background-color","#B2E0FF"); }); </script> </head> <body> <html> <body> <h1>Welcome to My Homepage</h1> <p class="intro">My name is Donald</p> <p>I live in Duckburg</p> <p>My best friend is Mickey</p> <div id="choose"> Who is your favourite: <ul> <li>Goofy</li> <li>Mickey</li> <li>Pluto</li> </ul> </div> </body> </html> </body> </html>
Click the "Run instance" button to view the online instance