<!DOCTYPE html>
<html lang="en"><head> <meta charset="UTF-8"> <title></title> <script src="js/jquery-2.0.3.min.js"></script> <script src="js/doT.min.js"></script></head><body><div id="interpolation"></div><script id="interpolationtmpl" type="text/x-dot-template"> { { for(var i=0;i<=it.length-1;i++){ if(it[i]==1){}} <div>hello</div>{ { } else{ }} <div>Hi { {=it[i]}}!</div>{ { } }} { { } }}</script></body>
<script>$(function(){ var data = [1,2,3];var interText = doT.template($("#interpolationtmpl").text());$("#interpolation").html(interText(data));})</script></html>