Highlight multiple rows using jQuery

Posted by cf_PhillipSenn on Stack Overflow See other posts from Stack Overflow or by cf_PhillipSenn
Published on 2010-12-29T01:58:51Z Indexed on 2010/12/29 2:54 UTC
Read the original article Hit count: 150

Filed under:

I'm putting together a succinct jQuery matrix because I'm having a hard time navigating around on the jQuery site, and the cheat sheets don't seem to provide me what I want either.

Here's how I highlight the rows:

$('.eq').hover(function() {
    $('.eq').toggleClass('highlight');
});
$('.is').hover(function() {
    $('.is').toggleClass('highlight');
});

Q: How can I write a function that says "toggle everything in the same class as what is being hovered over"? Something like:

function toggle(that){
    $(that.className).toggleClass('highlight');
}

© Stack Overflow or respective owner

Related posts about jQuery