DomTemplate Example
Events are registered using event handlers in a way that is similar to normal
HTML event registration. All you need is the ${...} clause to point to a function.
Here we are registering an onClick handler for the div. Any type of event
handler can be registered.
HTML
<script src="https://github.com/PAEz/domtemplate/raw/master/lib/domtemplate.js"></script>
<div id="ex4" onclick="${clickHandler}">Hello</div>
JavaScript
template('ex4', {
clickHandler: function(ev) {
console.log('div clicked');
}
});