0

I am trying to remove a specific CSS class from every element on the page. Would I just do something like:

$(body).removeClass('removethis');
$(body).each().removeClass('removethis');

I don't know the correct way to do this. I am doing this to automatically remove a class from every element on the page when javascript is enabled.

2
  • Sounds like you should be using a single class on the body, rather than tagging every element with a "no-js" identifier. Commented Dec 19, 2012 at 22:04
  • I only use this like 2 or 3 times. Commented Dec 19, 2012 at 22:04

1 Answer 1

8
$(".removeThis").removeClass("removeThis");

That will remove the class from every element that has that class.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.