title: jsRender create an template for html table , given a certain number of rows and cols
body: <p>I need to do something like <a href="http://jsfiddle.net/edaloicaro18/t5MYG/3/" rel="nofollow noreferrer">this</a>, but using templates.</p>
  <p>Do you know how to use counters inside a template? I ask you because I need those counters to generate the IDs for the inputs I create.</p>
  <p><strong>HTML Code:</strong></p>
  <pre><code>&lt;div&gt; 
      &lt;span&gt;N Cols:&lt;/span&gt;
      &lt;input id=&quot;txtNCols&quot; type=&quot;text&quot; /&gt; 
      &lt;span&gt;N Rows:&lt;/span&gt;
      &lt;input id=&quot;txtNRows&quot; type=&quot;text&quot; /&gt;
      &lt;input type=&quot;button&quot; id=&quot;btnCrearMatriz&quot; value=&quot;Create&quot; /&gt;
  &lt;/div&gt;
  </code></pre>
  <p><strong>JS Code</strong></p>
  <pre><code>$('#btnCrearMatriz').click(function () {
      var rows = $('#txtNRows').val(); //here's your number of rows and columns
      var cols = $('#txtNCols').val();
      var table = $('&lt;table&gt;&lt;tbody&gt;');
      for (var r = 0; r &lt; rows; r++) {
          var tr = $('&lt;tr&gt;');
          for (var c = 0; c &lt; cols; c++){
               var td=$('&lt;td&gt;');
               var textbox=&quot;&lt;input type='text' id='txt_r&quot; +(r+1) + &quot;c&quot;+ (c+1) + &quot;'/&gt;&quot;;
               td.append(textbox);
               td.appendTo(tr);
          }      
          tr.appendTo(table);
      }
  
      table.appendTo('body');
  });
  </code></pre>
  <p>Thanks in advance.</p>
  <h1>EDIT:</h1>
  <p>I've just found <a href="https://github.com/BorisMoore/jsrender/issues/199" rel="nofollow noreferrer">this</a> . Well, it seems that getting what I need, will be much more difficult than I thought.</p>
  <p>Anyway, I tried something like this , but apparently it doesn't support multiple levels of nesting :(</p>
  <pre><code>&lt;script id=&quot;table_template&quot; type=&quot;text/x-jsrender&quot;&gt;
     &lt;table&gt;
          &lt;tbody&gt;
             {{range start=1 end=rows}}
                    &lt;tr&gt;
                     {{range start=1 end=cols}}
                          &lt;td&gt;
                              &lt;input type=&quot;text&quot;/&gt;
                          &lt;/td&gt;
                     {{/range}}
                    &lt;/tr&gt;         
              {{/range}}
          &lt;/tbody&gt;
     &lt;/table&gt;
  &lt;/script&gt;
  </code></pre>