A: 

You need to find the siblings between two rows then loop through those to apply the class.

You probably need to find which child you clicked on initially keep that somewhere as number of the row in the table - then find the number of the row you are currently clicked on then you can work out the rows inbetween.

matpol
A: 

when you select the first row, the CSS class will be applied to it. Then when holding shift and selecting another row, you simply need to look for the row that has the coloradd CSS class, get it's position or index in the tr collection for that table, get the index or position of the row just clicked on, slice the jQuery collection to return only the rows between and then add the class to them.

Russ Cam
+1  A: 
if(e.shiftKey)
{
   // check previous selected row
   if( $('tr.coloradd:first').length == 1)
   {
     // okay, now check prev selected index
     var previndex = $('tr').index($('tr.coloradd:first'));

     // compare with current selected index
     var currindex = $('tr').index($(this));

     var startindex = previndex < currindex ? previndex : currindex;
     var stopindex = previndex > currindex ? previndex : currindex;

     $('tr').slice(startindex, stopindex + 1).addClass('coloradd');
   }
   else
   {
     $(this).addClass('coloradd'); // this is 1st selected row
   }
}
Anwar Chandra
$('tr').slice(startindex,stopindex+1).addClass("coloradd"); can also be used.. Thanks a lot for your help
Sumeru Suresh
ah yes I don't remember taht. updated :)
Anwar Chandra