How to remove child class from active div?
How to remove child class from active div?
184
31-Jul-2023
Updated on 01-Aug-2023
Aryan Kumar
01-Aug-2023Sure, here is how to remove a child class from an active div:
Using JavaScript
The following JavaScript code will remove the
active
class from thediv
element with the idmyDiv
:JavaScript
This code will first get the
div
element with the idmyDiv
. Then, it will call theclassList.remove()
method to remove theactive
class from thediv
element.Here is an example of how to use this code:
HTML
This code will create a
div
element with the idmyDiv
. Thediv
element will have theactive
class. When the user clicks on thediv
element, theactive
class will be removed from thediv
element.