Metoda jQuery removeAttr()
Przykład
Usuń atrybut stylu ze wszystkich <p> elementów:
$("button").click(function(){
$("p").removeAttr("style");
});
Definicja i użycie
Metoda removeAttr() usuwa jeden lub więcej atrybutów z wybranych elementów.
Składnia
$(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 |
Spróbuj sam - przykłady
Jak usunąć atrybuty id i class z wybranych elementów.