This does a highlight on mouseover and remove highlight on mouseout. Is this what you want?
// untested $("#storeListTable tbody tr").hover( function() { // mouseover $(this).addClass('highlight'); }, function() { // mouseout $(this).removeClass('highlight'); } ); On Apr 14, 11:51 am, spstieng <spsti...@hotmail.com> wrote: > I've tested different solutions found in here, and on the web, but I > can't get it working. > I simply want to highlight a table row. > > I would like to you toggleClass > $(this).parents('tr').toggleClass("highlight"); > > This is my HTML code: > <html> > <head> > <title>Title</title> > <link rel="stylesheet" href="css/storeLocator.css" type="text/css" > media="screen" charset="utf-8" /> > <script type="text/javascript" src="js/jquery.js" charset="utf-8"></ > script> > </head> > <body> > > <table id="storeListTable"> > <thead> > <tr class="even"> > <th>ID</th> > <th>Navn</th> > <th>E-post</th> > <th>Nettside</th> > </tr> > </thead> > <tbody> > <tr class="" id="store1"> > <td>10</td> > <td>Boss Store Oslo</td> > <td> <a href="mailto:">E-post</a></td> > <td> <a href="#">www</a></td> > </tr> > <tr class="" id="store3"> > <td>8</td> > <td>Brandstad Oslo City</td> > <td> <a href="mailto:a...@brandstad.no">E-post</a></td> > <td> <a href="#">www</a></td> > </tr> > <tr class="even" id="store4"> > <td>7</td> > <td>Fashion Partner AS</td> > <td> <a href="mailto:b...@fashionpartners.com">E-post</a></td> > <td> <a href="#">www</a></td> > </tr> > <tr class="" id="store5"> > <td>1</td> > <td>Follestad</td> > <td> <a href="mailto:c...@online.no">E-post</a></td> > <td> <a href="#">www</a></td> > </tr> > <tr class="even" id="store6"> > <td>2</td> > <td>Follestad</td> > <td> <a href="mailto:d...@follestad.com">E-post</a></td> > <td> <a href="#">www</a></td> > </tr> > </tbody> > </table> > </body> > </html> > > My js file looks like this: > jQuery(document).ready(function() { > > jQuery("#storeListTable tr").mouseover(function () { > $(this).parents('#storeListTable tr').toggleClass("highlight"); > alert('test'); > }); > > }); > > The ALERT is there to demonstrate that the function fiores on > mouseover. > > Can anyone help me please? :)