Can I remove a specific CSS class from all XYZ elements within an element at once?
Example: Remove CSS class active
from all <a>
anchors within my search div
.
If so, how?
To remove all CSS classes of an element, we use removeClass() method. The removeClass() method is used to remove one or more class names from the selected element.
Try it Yourself - Examples How to use addClass() and removeClass() to remove one class name, and add a new class name. Using a function to remove a class from the selected elements. How to remove several class names from the selected elements.
The removeAttr() method is an inbuilt method in jQuery which is used to remove one or more attributes from the selected elements. Parameters: This function accepts single parameter attribute which is mandatory. It is used to specify one or more attributes to remove.
$("#mydiv a").removeClass("active");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With