title: Jquery Find which button is clicked then run a specific If else statement? (Newbie)
body: <p>I'm really new to Jquery and am trying to figure out how to determine which link was clicked and then run a if else statement. This is for a video game fansite. </p>
  
  <p>I have a table set up for unit stats and bunch of Divs set up as buttons (link with display set to block), when a button is clicked it populates the table with that units data and images. I have that working properly. Now in some cases a unit has an alternate weapon with different stats. I have a blank tr tag with a Link inside that only gets text in the td tag when the unit has an alternate weapon. </p>
  
  <p>What I'm looking to do is have that link alternate (toggle) weapon stats without leaving or refreshing the page. I got it working with one unit but it's alternating the table data (html) the same way for every unit that has that specific link appear. I need it to know which button was clicked and then when the alt link appears, it toggles the proper weapon data for that unit.</p>
  
  <p>I really hope this makes sense because this is only my second day working with jquery. please be as specific as you can with help since I'm a newbie. Thanks so much</p>
  
  <p>My html set up is.</p>
  
  <pre><code>&lt;div id="unit1"&gt;&lt;a href="#"&gt;Unit 1&lt;/a&gt;&lt;/div&gt;
  
  &lt;div id="Unit2"&gt;&lt;a href="#"&gt;Unit 2&lt;/a&gt;&lt;/div&gt;
  
  &lt;div id="Unit3"&gt;&lt;a href="#"&gt;Unit 3&lt;/a&gt;&lt;/div&gt;
  
  &lt;table&gt;
  
  &lt;tr&gt;
  &lt;td&gt;&lt;a id="altweapon" href="#"&gt;&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;&lt;span id="weapName"&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td&gt;&lt;span id="attack"&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;td&gt;&lt;span id="range"&gt;&lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;/table&gt;
  </code></pre>
  
  <p>My jquery set up.</p>
  
  <pre><code>$("#Unit1").click(function(){
     $("#altweapon").html("");
     $("#weapName").html("weapon 1");
     $("#attack").html("10");            
  
   });
  $("#Unit2").click(function(){
     $("#altweapon").html("Alternate");
     $("#weapName").html("weapon 1");
     $("#attack").html("5");            
  
   });
  $("#Unit3").click(function(){
     $("#altweapon").html("Alternate");
     $("#weapName").html("weapon 1");
     $("#attack").html("15");            
  
   });
  
  $("#altweapon").click(function() {
      $("#altweapon").toggleClass("Wp1").toggleClass("Wp2");
  
      if ($("#altweapon").hasClass("Wp1"))
    {
          $("#weapon").html("Weapon 1");
  
    } else
    {
          $("#weapon").html("Weapon2");
    }
   });
  </code></pre>