Metoda jQuery removeProp()

❮ Metody jQuery HTML/CSS

Przykład

Dodaj i usuń właściwość o nazwie „kolor”:

$("button").click(function(){
  var $x = $("div");
  $x.prop("color", "FF0000");
  $x.append("The color property: " + $x.prop("color"));
  $x.removeProp("color");
});

Definicja i użycie

Metoda removeProp() usuwa właściwość ustawioną przez metodę prop() .

Uwaga: nie używaj tej metody do usuwania atrybutów HTML, takich jak style, id lub checked. Zamiast tego użyj metody removeAttr() .


Składnia

$(selector).removeProp(property)

Parameter Description
property Specifies the name of the property to remove

❮ Metody jQuery HTML/CSS