title: Clear text inside DIV
body: <p>I'm using the following HTML structure:</p>
  <pre><code>&lt;div id=&quot;clock&quot;&gt;5:30 AM
      &lt;div id=&quot;day&quot;&gt;Wednesday
      &lt;/div&gt;
      &lt;div id=&quot;date&quot;&gt;14 December
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>I update the contents of these elements using Javascript. For &quot;day&quot; and &quot;date&quot; I use <code>$(&quot;#day&quot;).text(day)</code> and <code>$(&quot;#date&quot;).text(date)</code>. Because &quot;clock&quot; is a parent element I had to use <code>$(&quot;#clock&quot;).prepend(clock)</code> to succesfully add the text.</p>
  <p>The problem with the latter function, is that new text is prepended every time the clock is refreshed, i.e. it builds up a list of clock times. For the first two functions the text is just replaced, like it should. Is there a way to make this happen for the &quot;clock&quot; function as well?</p>
  <p>EDIT: Sorry, should have been a bit more clear about the clock. Have edited the code, so you understand. BTW, the reason the clock is parent element is that could make the other two elements depend on the clock's position and styling.</p>
  <p>I also created a jsFiddle: <a href="https://jsfiddle.net/daanodinot/NZtFA/" rel="nofollow noreferrer">https://jsfiddle.net/daanodinot/NZtFA/</a>
  I left the list building thing (annoyingly) in!</p>
  <p>BTW, I'm not too sure if <code>function(); setInterval('function()', 1000)</code> is the best way to refresh, so if you something better I'd be happy to know :)</p>