Question #473   Submitted by Answiki on 05/19/2021 at 08:04:11 PM UTC

How to delete a class in Vanilla JS?

Answer   Submitted by Answiki on 08/17/2021 at 04:27:33 PM UTC

In JavaScript, the simplest way to remove a class from a given element is to use the method .remove() on the property .classList:

var element = document.getElementById('ID');
element.classList.remove('myClass');

7 events in history
Answer by Answiki on 08/17/2021 at 04:27:33 PM

In JavaScript, the simplest way to remove a class from a given element is to use the method .remove() on the property .classList:

var element = document.getElementById('ID');
element.classList.remove('myClass');

Question by Answiki 05/19/2021 at 08:04:25 PM
How to remove a class in JavaScript?
Question by Answiki 05/19/2021 at 08:04:19 PM
How to delete a class in JavaScript?
Question by Answiki 05/19/2021 at 08:04:11 PM
How to delete a class in Vanilla JS?
Question by Answiki 05/19/2021 at 08:03:57 PM
How to remove a class to a given element in Vanilla JS?
Answer by Answiki on 05/19/2021 at 08:03:48 PM

In JavaScript, the simplest way to remove a class from a given element is to use the method .remove() on the property .classList:

var element = document.getElementById('ID');
element.classList.remove('myClass');




Question by Answiki 05/19/2021 at 08:03:12 PM
How to remove a class to a given element in JavaScript?
# ID Query URL Count

Icons proudly provided by Friconix.