How to remove html attribute from JS DOM? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to remove html attribute from JS DOM?

1st Feb 2021, 10:06 AM
Unknown Ambusher 🗡️
Unknown Ambusher 🗡️ - avatar
2 Answers
+ 2
You can do it by using removeAttribute method Example: document.getElementsByTagName("div")[0].removeAttribute("class");
1st Feb 2021, 10:13 AM
Ayush Kumar
Ayush Kumar - avatar
1st Feb 2021, 10:36 AM
Unknown Ambusher 🗡️
Unknown Ambusher 🗡️ - avatar