I am trying to run a counter in my jQuery tmpl so that I can execute some logic after the template. The problem is that for some reason I canβt get the counter to increment by 1. It seems that it always increments by some random number.
Here is my HTML:
<div id='myDiv'></div> <script id='tpl'> ${i=0} ${i++} ${i++} ${i++} ${i++} </script>
... and this is what I call the template engine:
$.tmpl($('#tpl'), {}).appendTo("#myDiv");
I also added this to jsfiddle: http://jsfiddle.net/2ZtRL/1/
The result I would expect: 0 1 2 3 4 instead, I get 0 3 7 11 15
Totally strange! Help!
source share