Metode removeAttribute

Metode removeAttribute menghapus atribut yang ditentukan dari tag apa pun.

Sintaks

javascriptelemen.removeAttribute(nama atribut);

Contoh

Mari hapus atribut value untuk elemen:

html<input id="elem" value="abcde">
javascriptlet elem = document.querySelector('#elem');
elem.removeAttribute('value');

Kode HTML akan terlihat seperti ini (atribut value menghilang):

html<input id="elem">

Lihat juga