Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Remove CSS Class from all Descendants at once

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?

like image 422
Alex Avatar asked Sep 22 '09 22:09

Alex


People also ask

How do I remove all CSS from a class?

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.

How do you remove CSS class to an element using jQuery explain with one example?

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.

How do I remove ATTR?

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.


1 Answers

$("#mydiv a").removeClass("active");
like image 179
Vincent Ramdhanie Avatar answered Oct 24 '22 16:10

Vincent Ramdhanie