title: Jquery hide Images in a single table from a list of tables
body: <p>I'm creating some html dynamically from an asp.net page and filling out a list of tables with links. 
  The behavior i'm looking for is hiding the images in the following rows when i click on the first element in the table, without hiding all the images in the rest of the table.
  the jquery code i'm using is:</p>
  
  <blockquote>
  <pre><code>$(document).ready(function () {
      $('.AddMainInterest').click(function (event) {
          var url = $(this).attr("href");
          if ($.browser.msie) {//hacked together for IE browsers
              centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120) / 2) - (75)));
              centeredX = window.screenLeft + ((((document.body.offsetWidth + 20) / 2) - (150)));
          } else {
              centeredY = window.screenY + (((window.outerHeight / 2) - (75)));
              centeredX = window.screenX + (((window.outerWidth / 2) - (150)));
          }
          window.open(url, null, 'toolbar=no,location=no,menubar=no,width=300,height=150,resizable=yes,scrollbars=no,left=' + centeredX + ',top=' + centeredY).focus();
          event.preventDefault();
          this.href = this.href.replace("act=a", "act=d");
          $(this).prev().toggle();
          $("#imgInterest img").hide().filter(":first").show();
      });
  });
  </code></pre>
  </blockquote>
  
  <p>but this is hiding all the following images, how can i make hide only the images in the same table???</p>
  
  <p>the code looks something like the following:</p>
  
  <pre><code>   &lt;table id="imgInterest" width="100%;"&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=2&amp;sc=Y&amp;act=a" class="AddMainInterest"&gt;
                  &lt;img id="first" src="~/icons/CheckMark.png" class="first"&gt;Agriculture (General)&lt;/a&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr valign="middle"&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx" class="AddInterest"&gt;Agricultural Facilities and Equipments&lt;/a&gt;&lt;img
                  src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=4&amp;sc=Y01&amp;act=a" class="AddInterest"&gt;Agricultural
                  Science&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=5&amp;sc=Y02&amp;act=a" class="AddInterest"&gt;Algology&lt;/a&gt;&lt;img
                  src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=6&amp;sc=Y03&amp;act=a" class="AddInterest"&gt;Animal Behavior&lt;/a&gt;&lt;img
                  src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=7&amp;sc=Y07&amp;act=a" class="AddInterest"&gt;Animal Health
                  and Nutrition&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=8&amp;sc=Y04&amp;act=a" class="AddInterest"&gt;Animal Physiology&lt;/a&gt;&lt;img
                  src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=9&amp;sc=Y08&amp;act=a" class="AddInterest"&gt;Aquaculture
                  and Fisheries&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=10&amp;sc=Y09&amp;act=a" class="AddInterest"&gt;Crop and
                  Plant Production&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=11&amp;sc=Y05&amp;act=a" class="AddInterest"&gt;Forestry
                  Science&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=12&amp;sc=Y10&amp;act=a" class="AddInterest"&gt;Pesticides,
                  Insecticides and Herbicides&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=13&amp;sc=Y12&amp;act=a" class="AddInterest"&gt;Plant Sciences&lt;/a&gt;&lt;img
                  src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=14&amp;sc=Y11&amp;act=a" class="AddInterest"&gt;Policy,
                  Reviews and Evaluations&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=15&amp;sc=Y13&amp;act=a" class="AddInterest"&gt;Soil Sciences&lt;/a&gt;&lt;img
                  src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=16&amp;sc=Y14&amp;act=a" class="AddInterest"&gt;Zoology
                  and Animal Science&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
          &lt;/td&gt;
          &lt;td&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/li&gt;&lt;li&gt;
      &lt;table id="imgInterest" width="100%;"&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=17&amp;sc=A&amp;act=a" class="AddMainInterest"&gt;
                      &lt;img id="first" src="~/icons/CheckMark.png" class="first"&gt;Arts and Literature (General)&lt;/a&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr valign="middle"&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=18&amp;sc=A01&amp;act=a" class="AddInterest"&gt;Architecture&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=19&amp;sc=A02&amp;act=a" class="AddInterest"&gt;Art History&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=20&amp;sc=A03&amp;act=a" class="AddInterest"&gt;Children's
                      Literature&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=21&amp;sc=A04&amp;act=a" class="AddInterest"&gt;Culture
                      Heritage&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=22&amp;sc=A05&amp;act=a" class="AddInterest"&gt;Folklore&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=23&amp;sc=A06&amp;act=a" class="AddInterest"&gt;Latin&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=24&amp;sc=A07&amp;act=a" class="AddInterest"&gt;Literature&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=25&amp;sc=A08&amp;act=a" class="AddInterest"&gt;Music&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=26&amp;sc=A09&amp;act=a" class="AddInterest"&gt;Visual and
                      Performing Arts&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;tr id="clear"&gt;
                  &lt;td&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/li&gt;
  &lt;li&gt;
      &lt;table id="imgInterest" width="100%;"&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=27&amp;sc=B&amp;act=a" class="AddMainInterest"&gt;
                      &lt;img id="first" src="~/icons/CheckMark.png" class="first"&gt;Astronomy/Astrophysics/Space
                      Science (General)&lt;/a&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr valign="middle"&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=543&amp;sc=B10&amp;act=a" class="AddInterest"&gt;Aircrafy
                      and Flight&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=544&amp;sc=B11&amp;act=a" class="AddInterest"&gt;Astronomy
                      and Astrophysics&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=28&amp;sc=B01&amp;act=a" class="AddInterest"&gt;Celestial
                      Mechanics&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=29&amp;sc=B02&amp;act=a" class="AddInterest"&gt;Cosmology&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=30&amp;sc=B03&amp;act=a" class="AddInterest"&gt;Extragalactic
                      Astronomy&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=31&amp;sc=B04&amp;act=a" class="AddInterest"&gt;Interstellar
                      Matter&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=32&amp;sc=B05&amp;act=a" class="AddInterest"&gt;Meteors&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=545&amp;sc=B12&amp;act=a" class="AddInterest"&gt;Policy,
                      Reviews and Evaluations&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=33&amp;sc=B06&amp;act=a" class="AddInterest"&gt;Solar Terrestrial
                      Physics&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=546&amp;sc=B13&amp;act=a" class="AddInterest"&gt;Space Exploration
                      and Development&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=547&amp;sc=B14&amp;act=a" class="AddInterest"&gt;Space Systems
                      and Hardware&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=34&amp;sc=B07&amp;act=a" class="AddInterest"&gt;Stars&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=35&amp;sc=B08&amp;act=a" class="AddInterest"&gt;The Sun&lt;/a&gt;&lt;img
                      src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;a href="~/page.aspx?uid=-1&amp;pid=10&amp;sid=36&amp;sc=B09&amp;act=a" class="AddInterest"&gt;Theoretical
                      Astrophysics&lt;/a&gt;&lt;img src="~/icons/CheckMark.png" class="img-swap"&gt;
              &lt;/td&gt;
              &lt;td&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>