2:42 am - Saturday May 25, 2013

how to change html table background color on hover using jquery

Change html table back­ground color on hover using jquery.A sim­ple way to change back­ground color of rows of table on hover using jquery. In other way, Users may want to know on which table row they are viewing.This sim­ply high­lights the table row.

Copy the css down below

   .hover{
       background-color: rgb(254,252,234);
    }

Add jquery code down below in your script tag

    $('#tableId tbody tr').hover(function() {
        $(this).addClass('hover');
    }, function() {
        $(this).removeClass('hover');
   });

You May Also Like:

Filed in: Javascript, Table

2 Responses to “how to change html table background color on hover using jquery”

  1. Bharani Kumar
    November 30, 2012 at 3:42 pm #

    How to focus a check box when val­i­da­tion goes wrong in IE8, i tried a lot but for me it is not work­ing. can you explain it with exanple.

  2. November 30, 2012 at 4:07 pm #

    @bharani

    Could you please be more spe­cific do you want to focus after val­i­da­tion goes wrong or do you want check­box to be checked.However, Here is the demo http://jsfiddle.net/CPFrZ/ is this the func­tion­al­ity you are look­ing for or let me know what else need’s to be done.

Leave a Reply