Thursday, September 27, 2012

jQuery attribute selector


The jQuery attribute selectors are used to select elements from a page based on the attributes of the element. For example the “#” selector will select elements based on the ID of the elements.

In this post we shall see the various attribute selectors available in jQuery, and how to use them to filter out elements of specific type.

The following are the attribute selectors available in jQuery.

Selector
Type of Element selected
#
Selects elements based on the ID of the Element
.
Selects elements based on the class of the Element
[attribute]
Selects all elements which have the specific attribute
[attribute=value]
Selects all elements with the specified attribute and the specified value
[attribute!=value]
Selects all elements with the specified attribute and not the specified value
[type=value] [attribute=value]
Selects all elements of the specified type which have the specified value for the attribute.
[type=value] [attribute!=value]
Selects all elements of the specified type which do not have the specified value for the attribute.

Search Flipkart Products:
Flipkart.com

No comments: