Homer_J
Homer_J

Reputation: 3323

jQuery Table row highlighting query

I have the following code:

$('table tr:not(:first-child)').mouseover(function() {
  $(this).removeClass('hovered_error');
  $(this).addClass('hovered');
  }).mouseout(function() {
  $(this).removeClass('hovered');
});

This very nicely highlights a table row. However, I now have more than one table on the same page and I only want the above highlighting to work for one of the tables.

Any ideas how I might achieve this?

Upvotes: 1

Views: 75

Answers (1)

tymeJV
tymeJV

Reputation: 104775

Give the table you want to omit a unique ID (ex hoverTable)

$('table:not(#hoverTable) tr:not(:first-child)').mouseover(function() {

Upvotes: 2

Related Questions