You are replacing the template with the html in the first updateClock(). Put your <script>
template tags outside of the container, or cache the template, as you do not need to get the template every updateClock(). Get it once at the start, and reuse it, then it won't matter if you have replaced it in the HTML i.e.
var template = $('#template').html();
var updateClock = function(){
var data = {
'date': getDate(),
'day': getDay(),
'hour': getHour(),
'minute': getMinute()
};
$('.container').html(Mustache.render(template, data));
};
updateClock();
setInterval(updateClock, 30000);
I personally store and cache all my templates namespaced, so as to not pollute the global namespace, something like:
var MoustacheTemplates =
{
ClockTemplate : $('#template').html(),
AnotherTemplate: $('#anothertemplate').html(),
AndAnotherOne : $('#andanothertemplate').html()
};
and then you can use them sort of 'Strongly Typed'
eg
$('.container').html(Mustache.render(MoustacheTemplates.ClockTemplate, data));
you, of course, have to cache them before you use any of them