Revision: 57690
                            
                                                            
                                    
                                        
Updated Code
                                    
                                    
                                                    
                        at June 6, 2012 04:57 by mattvbiggs
                            
                            Updated Code
$('#SurveyGrid input:not(#selectAll)').click(function () {                
   if ($(this).attr("checked") == true) {
      $(this).parent().parent().addClass('highlight');
   } else {
      $(this).parent().parent().removeClass('highlight');
   }
});
                                
                            Revision: 57689
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at June 6, 2012 04:21 by mattvbiggs
                            
                            Initial Code
$('#SurveyGrid input').click(function () {                
   if ($(this).attr("checked") == true) {
      $(this).parent().parent().addClass('highlight');
   } else {
      $(this).parent().parent().removeClass('highlight');
   }
});
                                Initial URL
Initial Description
The following code snippet will highlight the row in a table when the checkbox is checked. It will remove the highlight when the checkbox is unchecked. This will work for basic <table> as well as a GridView. The "input:not(#selectAll)" will ignore the row that contains a SelectAll checkbox with the ID "selectAll". Note: I had a css class defined as highlight where I set the background-color property.
Initial Title
jQuery: Highlight Rows Using Checkbox
Initial Tags
jquery
Initial Language
jQuery