jquery - javascript toggle table row background color on click -


so have javascript code on table row click exapnds subsequent table rows until finds same table row class again.

if hover on row changes gray expected.

the stuff doesn't work when click on table row, want table row background color same hover (gray). color should disappear when click , collapse row.

i tried add toggle class seen below.

$('.my-class').click(function(){      $(this).nextuntil('tr.my-class').slidetoggle(100);     $(this).toggleclass("tr.my-class.negative.clicked"); }); 

but not sure if right approach. here jsfiddle: http://jsfiddle.net/dhdrg/3/

just heads up. worked , might better solution:

$('.my-class').click(function(){      $(this).nextuntil('tr.my-class').slidetoggle(100);     $(this).toggleclass("clicked");  }); 

http://jsfiddle.net/dhdrg/7/


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -