0

I have a table that when tr are clicked drops down another table as of right now i have the tr with a hover color in place of banded the rows. I set up the javascript to change the background color when you click the tr but is there a way to edit the css back to the default

var parent = $('.surveyResponses');

$('.data[question]', parent).on({
    'click' : function(){
        var clicked = $(this);
        $('[question='+clicked.attr('question')+']',parent).eq(1).slideToggle('slow', function(){
            if ( $('[question='+clicked.attr('question')+']',parent).eq(1).css('display') == 'block' ) {
                clicked.css('backgroundColor', '#535353');
            }
            else{
                clicked.css('backgroundColor', '#747373');
                clicked.css('backgroundColor:hover', '#535353');
            }
        });
    }
});

if possible i would not want to make a jquery hover event

jsfiddle http://jsfiddle.net/Des58/1/

spy-killer
  • 405
  • 4
  • 18

1 Answers1

2

Use classes: you can't do inline hover events.

Example:

var elem = $("#elem");

if (mybool)
    elem.removeClass("a").addClass("b");
else
   elem.removeClass("b").addClass("a");

I hope I'm understanding you correctly.

Community
  • 1
  • 1
sheng
  • 1,226
  • 8
  • 17