If I get you right, you might just want to use .toggleClass()
.
$('#obj').click(function() {
$(this).toggleClass('foo bar');
});
Ref.: .toggleClass()
Example: http://www.jsfiddle.net/sTBcb/
jAndy
2010-10-28 19:30:56