jQuery: Temporarily change a style then reset to original class

I know this is old, but you can just set the value to an empty string to remove your custom style like so:

// set
$(this).css('background-color', '#000000');

// reset
$(this).css('background-color', '');

Jquery adds CSS in the style attribute which has higher priority over what is in your CSS file. You're not changing your CSS document with that function and thus adding and removing and adding the class have no effect since it hasn't been modified at all!

You should use the same function but set the background color to black this time.

function reset(this)
{
  $(this).css('background-color', '#000000');
}

Or simply remove the style attribute

function reset(this)
{
  $(this).removeAttr('style');
}

What about toggleClass("testThing")? I use it when there's more than one property to change.

http://api.jquery.com/toggleClass/