attribute
UK[əˈtrɪbju:t] US[əˈtrɪbjut]
vt. Think that... is; attribute... to; attribute the quality of... to someone; think that... Something [thing] belongs to someone [thing]
n. Attribute; (characteristics of a person or thing); value; [Grammar] Attributive
jquery attribute selector syntax
Function: [attribute] Selects each element with the specified attribute. Elements with any attribute can be selected (there are no restrictions on specified attributes).
Syntax: $("[attribute]")
Parameters: attribute Required. Specifies the properties to look for.
jquery attribute 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(){ $("[id]").css("background-color","#B2E0FF"); }); </script> </head> <body> <html> <body> <h1 id="main_header">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> <h3 id="sub_header">My uncle is Scrooge</h3> <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