javascript - Changing ClassName in jQuery -


I know that we can do many things like changing an existing style of an element, or changing its text, etc. But, for example, the following CSS file has two different styles:

 . RoundedCorners {spherical taxpayers for code * *} NotSoRoundedCorners {/ Code for NotSoRoundedCorners} / /   

More buttons look like this:

  & lt; Input type = "submit" class = "notarordered corners" value = "turn me on!" / & Gt;   

I know that we can change our style directly with a simple jQuery cutting:

  $ ('close'). CSS ({'visibility': 'hidden'}, 1000); // e.t.c.   

But, what if there are many styles to change for one element. Why are there not just 2 style definitions in the CSS file, and when we need to change the style, can the name of the element change its name to another?

You should invite the jQuery method

Using it, you can explicitly delete and add a class are left in the node, the other sections are insulated .

  $ ('close'). ToggleClass ('roundedCorners NotSoRoundedCornders');   

Many people recommend using .attr () here, but this entire className attribute And therefore overwrite / delete any CSS class. I do not think this is the way to go.

Comments