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

Seletor de Atributo [attribute=value] do jQuery

Seletor jQuer

[ Attribute = value Seletor usado para selecionar elementos que possuamAtributoeValor [ [attribute=value] doElemento.

Sintaxe:

$("[attribute='value']")

Exemplo

Selecionar o valor do atributo href de cada elemento <a> igual a “ / CSS3 /”:

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

Valor do Parâmetro

ParâmetroDescrição
attributeEspecificar o nome do atributo a ser selecionado
valueEspecificar o valor a ser selecionado

Seletor jQuer