jQuery removeAttr() Metode
Contoh
Hapus atribut gaya dari semua elemen <p>:
$("button").click(function(){
$("p").removeAttr("style");
});
Definisi dan Penggunaan
Metode removeAttr() menghapus satu atau lebih atribut dari elemen yang dipilih.
Sintaksis
$(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 |
Cobalah Sendiri - Contoh
Cara menghapus atribut id dan kelas dari elemen yang dipilih.