---
title: "How to remove child class from active div?"  
description: "How to remove child class from active div?"  
author: "Utpal Vishwas"  
published: 2023-07-31  
updated: 2023-08-01  
canonical: https://www.mindstick.com/forum/159389/how-to-remove-child-class-from-active-div  
category: "jquery"  
tags: ["jquery", "jquery selectors", "html element"]  
reading_time: 1 minute  

---

# How to remove child class from active div?

How to [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) child [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) from [active](https://answers.mindstick.com/qa/97113/why-does-an-active-ftp-not-work-with-network-firewalls) div?

## Replies

### Reply by Aryan Kumar

Sure, here is how to remove a child class from an active div:

## Using JavaScript

The following JavaScript code will remove the `active` class from the `div` element with the id `myDiv`:

JavaScript

```plaintext
function removeActiveClass(div) {
  div.classList.remove("active");
}

// Call the function
removeActiveClass(document.getElementById("myDiv"));
```

This code will first get the `div` element with the id `myDiv`. Then, it will call the `classList.remove()` method to remove the `active` class from the `div` element.

Here is an example of how to use this code:

HTML

```plaintext
<html>
<body>

<div id="myDiv" class="active">
  This is an active div.
</div>

<script>
function removeActiveClass(div) {
  div.classList.remove("active");
}

// Call the function
removeActiveClass(document.getElementById("myDiv"));
</script>

</body>
</html>
```

This code will create a `div` element with the id `myDiv`. The `div` element will have the `active` class. When the user clicks on the `div` element, the `active` class will be removed from the `div` element.


---

Original Source: https://www.mindstick.com/forum/159389/how-to-remove-child-class-from-active-div

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
