DomTemplate Example

If an element contains a `foreach` attribute, then that element will be repeated in the final document once for each member of the array returned by the attribute value.

HTML

<script src="https://github.com/PAEz/domtemplate/raw/master/lib/domtemplate.js"></script>
    <div id="ex7">
      <span foreach="index in ${array}">${index}</span>
    </div>

JavaScript

template('ex7', {
    array: [1, 2, 3]
});