You can use toggleClass to toggle a particular class on/off. So you
could chain two calls together to turn two classes on/off. One would
be on and one would be off.

<div class="class1">...</div>
$('div').toggleClass('class1').toggleClass('class2');

Would result in:
<div class="class2">...</div>

Doing it again would swap out class2 for class1.

API docs for toggleClass:
http://jquery.bassistance.de/api-browser/#toggleClassString
--
Brandon Aaron

On 3/13/07, rolfsf <[EMAIL PROTECTED]> wrote:
>
> Is there something like a swapClass function that will toggle between two
> classes? Or do I need to toggle between functions that addClass and
> removeClass?
>
> Thanks
> --
> View this message in context: 
> http://www.nabble.com/is-there-a-simple-function-to-swap-two-classes--tf3397695.html#a9460455
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to