I have created a table having rows with alternating colours(say yellow and red). Now, I want to change the colour of the clicked row to one common colour(say blue).And revert back to its original colour when clicked again.
I’m able to change the colour using this code
$("#mainTable").find('#'+IDClicked).css("background-color", "#bbbbff");
I’m not able to figure out how to revert back.
We assume that your code this this way:
HTML
In that case, you can use jQuery this way:
And finally the CSS part:
Fiddle: http://jsbin.com/icusec/2