Kendo UI DateTime Stamp Template via Script Assigment

template assigned to a var within a script and then assigned to a div tag to display variable data mixed in the html boilerplate

by David McClelland

HTML

<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.default.min.css">
<script src="http://cdn.kendostatic.com/2012.3.1114/js/kendo.all.min.js"></script>
<div id="targetDiv"></div>

JavaScript

var dateObject = new Date();

// assign the template object Kendo Template Object that uses a string to define itself. variable data inside the hash tags is replaced when applied to a target such as a div tag. "=" operator must follow first hash.
var templateObject = kendo.template("<br/><br/><hr/><p style='text-align:center'>Today is #=dateObject #</p><hr/>");

// assign the template to a div to have the div replaced with the template, including an injection of the variable data
$("#targetDiv").html(templateObject(dateObject));