Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a class from the entire document

Tags:

jquery

I tried $(document).removeClass("myClassname") but it doesn't seem to work.

like image 932
SIndhu Avatar asked Feb 29 '12 22:02

SIndhu


People also ask

How do I remove a class from a document?

To remove a class from an element, you use the remove() method of the classList property of the element.

How do you remove a specific class from all elements?

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 I delete a class in CSS file?

To add the CSS classes to an element we use addClass() method, and to remove the CSS classes we use removeClass() method.


2 Answers

$(".myClassname").removeClass("myClassname")

$(".myClassname") will match all elements that have the class myClassname.

like image 135
villecoder Avatar answered Sep 21 '22 13:09

villecoder


I think you are looking for this. It will select all the elements with class myClassname and remove that class for those elements.

$('.myClassname').removeClass('myClassname');
like image 40
ShankarSangoli Avatar answered Sep 20 '22 13:09

ShankarSangoli