JQuery .hover problem

Discussion in 'HTML & Website Design' started by denhamd3, Sep 24, 2008.

  1. #1
    Hi,

    I'm trying to add a class to a <td> tag (which already has a class "description" on it) within a <tr> using JQuery when the user hovers over the <tr> tag. But my code doesn't seem to work. Please can you help? Here is my code:

    $(document).ready(function(){
    $(
     function()
     {
      $("table.mytable tr").hover(
       function()
       {
        $(this).("td.description").addClass("highlight");
       },
       function()
       {
        $(this).("td.description").removeClass("highlight");
       }
      )
     }
    )
      });
    Code (markup):
     
    denhamd3, Sep 24, 2008 IP