title: Change bgcolor on toggled tr and on key shortcut
body: <p>I have the following toggle function <code>filter()</code> where I display the <code>childrow</code> of a table when the <code>&lt;tr&gt;</code> parent is being clicked. In this function I've also included a key shortcut, so whenever ALT+A is pressed all the childrows are displayed.</p>
  
  <p>In addition I have another script, <code>mouseover()</code>,  where the background color of the parent <code>tr</code> is changed to <code>#2C4367</code> hover.</p>
  
  <p><strong>So here's my question:</strong> How can I toggle the background-color of a tr parent whenever I expand (click on) it and back to normal when it is closed. This function should also work on all <code>tr</code> parents when the key shortcut is pressed, so the background color of all parent <code>tr</code>'s is changed when the shortcut is being pressed.</p>
  
  <p>I hope I made myself clear. Otherwise please say so and I will try to elaborate.</p>
  
  <p><strong><code>Toggle filter() script:</code></strong></p>
  
  <pre><code>$(document).ready(function mouseover(){
      $(".parent").hover(function(){
          $(this).css("background", "#2C4367");
          $(this).css("color", "#FFFFFF");
      },
      function(){
          $(this).css("background", "#FFFFFF");
          $(this).css("color", "#000000");
      });
  });
  </code></pre>
  
  <p><strong><code>Change bgcolor mouseover() script:</code></strong></p>
  
  <pre><code>$(document).ready(function filter() {
      $('table.detail').each(function() {
          var $table = $(this);
          $table.find('.parent').click(function() {
              $(this).nextUntil('.parent').toggle(); // must use jQuery 1.4 for nextUntil() method
  
          }); /// Below is toggle on image
          var $childRows = $table.find('tbody tr').not('.parent').hide();
          $("img.pushme").toggle(function funcVis() {
              $childRows.show();
          },
          function() { $childRows.hide();
          });
          shortcut.add("Alt+A",function(){ funcVis() }); /// Shortcut functions
          shortcut.add("Alt+N",function(){ expandform() }); /// Shortcut functions
      });
  });
  </code></pre>