English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery [attribute=value] Attribute Selector

jQuery Selectors

[ Attribute = value Selector is used to select elements with specifiedattributeandValue [attribute=value] of theElement.

Syntax:

$("[attribute='value'])

Example

Select each <a> element whose href attribute value is equal to " / CSS3 /:

$("document").ready(function(){
  $("a[href='/CSS3/'].css({"background":"green", "color":"white"});
});
Test and see‹/›

Parameter Value

ParameterDescription
attributeSpecify the attribute name to be selected
valueSpecify the value to be selected

jQuery Selectors