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

Método removeAttr () do jQuery

HTML do jQuery/Método CSS

O método removeAttr () remove um ou mais atributos do elemento selecionado.

Para obter ou definir atributos HTML, useattr ()Método.

Sintaxe:

$ (selector).removeAttr (attribute)

Exemplo

Excluir o atributo estilo de todos os parágrafos:

$("button").click(function(){
  $("p").removeAttr("style");
});
Teste e Veja‹/›

Excluir o atributo href de todos os links de hipertexto:

$("button").click(function(){
  $("a").removeAttr("href");
});
Teste e Veja‹/›

Excluir múltiplos atributos:

$("button").click(function(){
  $("p").removeAttr("id class title");
});
Teste e Veja‹/›

Valor do Parâmetro

ParâmetroDescrição
attributeEspecificar um ou mais (separados por espaço) atributos a serem excluídos

HTML do jQuery/Método CSS