jQuery - Attribute Filtering

CSS, Javascript, and jQuery all borrow from the same method of selecting an element with a specified attribute.

Example 1

In the example below, elements with the TITLE attribite will be styled.

Button 1

Button 2

 


$("[title]").addClass("btn btn-success btn-lg");

 

Example 2

In this example below, only the button with a TYPE=BUTTON attribite will be styled.

 


$("[type=button]").addClass("btn btn-danger btn-lg");

http://www.w3schools.com/jquery/jquery_selectors.asp