title: Jquery Insert element before <tr>
body: <p>I am trying to insert a block element  Insert something  before another . I am not sure if I am using the right method but here is my code. Hope you guys can help. Thanks!</p>
  
  <p>Jquery</p>
  
  <pre><code>$("#addMatch").click(function(){
  
      $("&lt;td&gt;New insert&lt;/td&gt;").insertBefore("#addMatch").closest('tr');
  
      return false;   //this would insert the &lt;td&gt;New insert&lt;/td&gt; before the               
                      //&lt;td&gt;&lt;input type="button" id="addMatch" name="addMatch" value="Add 
                      //Match" &lt;/td&gt; but not &lt;tr&gt;
  });
  </code></pre>
  
  <p>Html</p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt;some data&lt;/td&gt;
  &lt;/tr&gt;
  
  //can't tell how many tr would show before the last "addMatch" button. It's dynamic. 
  // I want the &lt;td&gt;New insert&lt;/td&gt; show up here.
      &lt;tr&gt; 
      &lt;td&gt;&lt;input type="button" id="addMatch" name="addMatch" value="Add Match" &lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>