Say I have a class called testThing:
.testThing { background-color:#000000; float:left; height:50px; width:50px; }
And I want to be able to test the background color change for any control of this class when a button is clicked:
function setColor(someColor) { jQuery('.testThing').css('background-color', someColor); }
But I want the user to be able to reset to the original color (another click of a button) depending on what class has:
function resetClass() { jQuery('#currentColor').removeClass('testThing'); jQuery('#currentColor').addClass('testThing'); }
It looks like this will work (Albiet is not the best way to do this), but the background color of the control will not reset to the original value contained in this class.
Now either I need to find out why it is deleted, and not reset, or just an easy way to do it ... seeing that it seems silly to delete and read the class ...
jquery css
Programmin Tool Jun 27 '09 at 19:05 2009-06-27 19:05
source share