Metoda jQuery removeAttr().

❮ jQuery HTML/CSS metody

Příklad

Odeberte atribut stylu ze všech prvků <p>:

$("button").click(function(){
  $("p").removeAttr("style");
});

Definice a použití

Metoda removeAttr() odebere jeden nebo více atributů z vybraných prvků.


Syntax

$(selector).removeAttr(attribute)

Parameter Description
attribute Required. Specifies one or more attributes to remove. To remove several attributes, separate the attribute names with a space

Zkuste si to sami - příklady


Jak odstranit atribut id a class z vybraných prvků.


❮ jQuery HTML/CSS metody