jQuery removeProp() Metode

Metode HTML/CSS jQuery

Contoh

Tambah dan hapus properti bernama "warna":

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

Definisi dan Penggunaan

Metode removeProp() menghapus properti yang disetel oleh metode prop() .

Catatan: Jangan gunakan metode ini untuk menghapus atribut HTML seperti gaya, id, atau centang. Gunakan metode removeAttr() sebagai gantinya.


Sintaksis

$(selector).removeProp(property)

Parameter Description
property Specifies the name of the property to remove

Metode HTML/CSS jQuery