title: Overwrite tbody content jQuery
body: <p>I have a input field how can I enter the count number. </p>
  
  <p>First if I try enter the number 5, so I have five "tr" is good but if enter a new number example 4 so I have 9 "tr" and not 4. I like to overwrite the old state.</p>
  
  <p>How can I make this?</p>
  
  <p>Here my html code:</p>
  
  <pre><code>&lt;input type="text" id="count"&gt;
  
      &lt;table id="event_table"&gt;
          &lt;tbody&gt;
  
          &lt;/tbody&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>Here my jQuery code:</p>
  
  <pre><code>jQuery("#count").change(function() {
  
      var count = jQuery('#count').val();
  
      //built table
      var tr_var = "&lt;tr&gt;&lt;td&gt;date&lt;/td&gt;&lt;td&gt;time&lt;/td&gt;&lt;td&gt;icons&lt;/td&gt;&lt;/tr&gt;";
  
      for (var i = 0; i &lt; count; i++ ) {
          jQuery("#event_table tbody").append(tr_var);
      }
  
  });
  </code></pre>
  
  <p>Here my jsfiddle: <a href="http://jsfiddle.net/2cee8/" rel="nofollow noreferrer">http://jsfiddle.net/2cee8/</a></p>
  
  <p>Hope someone can help me.</p>