Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2007
    Posts
    141
    Thanks
    3
    Thanked 1 Time in 1 Post

    jquery row highlight

    hi guys i have a problem with jquery and css

    Code:
    	$("#bordercolor tbody td").hover(
        function() 
        {
            // This gets executed on mouse-over
            $(this).addClass('hover');
        }, 
        function() 
        {
            // This is the callback, so it gets executed on mouse-out
            $(this).removeClass('hover');
        }
    it will hover the td element of table with id="bordercolor"

    now the problem is i have 2 td but i just want to highlight the td for title not for content

    Code:
                      <tr>
                        <td class="windowbg2" align="left" valign="top" width="100%"><b><a href="#"><?php echo $item->get_title(); ?></a></b><br></td>
                      </tr>
                      <tr>
                        <td>
    						<p><?php echo $item->get_content(); ?></p>
    						
    						
    					</td>
                      </tr>

    see the first td is to display title and second td is to display content

    i just want that jquery to hover the title not the content.

    i know it has got something to do with $("#bordercolor tbody td")

    but i am not quite sure how css pair with jquery ( or javascript ) in too much detail.

    thanks

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    I think the simplest - and most semantically correct - way would be to put your table titles into TH tags rather than TD ones. That way you could apply your hovering code to $("#bordercolor tbody th")


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •