Questions tagged [removeclass]

A method to remove specific class(es) from a DOM element.

A method to remove specific class(es) from a DOM element.

619 questions
103
votes
6 answers

Remove all classes except one

Well, I know that with some jQuery actions, we can add a lot of classes to a particular div:
Let's say that with some clicks and other things, the div gets a lot of classes
DarkGhostHunter
  • 1,521
  • 3
  • 12
  • 23
41
votes
10 answers

addClass and removeClass in jQuery - not removing class

I'm trying to do something very simple. Basically I have a clickable div 'hot spot', when you click that it fills the screen and displays some content. I achieved this by simply changing the class of div, removing 'spot' and adding 'grown' and…
rhinoceros1
  • 411
  • 1
  • 4
  • 4
30
votes
5 answers

How to remove all instances of a class in javascript/jquery?

I have this class called .m-active that is used multiple times throughout my HTML. Basically what I want to do is remove all instances of that class when a user clicks on an image (which does not have the m-active class) and add the m-active class…
jdc987
  • 743
  • 3
  • 10
  • 20
29
votes
4 answers

How to: Add/Remove Class on mouseOver/mouseOut - JQuery .hover?

Looking to change the border color on a box.. ..when the user mouses over/out.. Here's the attempted code.. Needs Work! JQuery: