Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8745215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:58:16+00:00 2026-06-13T11:58:16+00:00

Consider following logic as requirement: var count=4; for(var i=0;i<count;i++) { /* create a table

  • 0

Consider following logic as requirement:

var count=4;

for(var i=0;i<count;i++)
{
  /* create a table row <tr></tr> */
}

Now if I where try do the same thing with my jquery template where in I want to try to do something as below:

<script id="MyTemplate" type="text/html">
        <table id="MyTable" class="Grid">            
            <tbody>
               {{each count}}
                <tr>
                  <td>${Name}</td>
                <tr>
           </tbody>
        </table>
</script>

where in the data I am trying to bind to template is :

var count=4;
var Name=["Peter","Michael","John","Thomas","James","Joseph","Mary","Simon"];

And the ouput I want my template to generate is:

<table id="MyTable" class="Grid">            
            <tbody>
                  <tr>
                    <td>Peter</td>
                    <td>Michael</td>
                    <td>John</td>
                    <td>Thomas</td>
                  <tr>
                  <tr>
                    <td>James</td>
                    <td>Joseph</td>
                    <td>Mary</td>
                    <td>Simon</td>
                  <tr>

           </tbody>
       </table>

I have already tried:

<script id="TestTemplate" type="text/x-jQuery-tmpl">
    Day:<br/>
    <table>
     <tbody>
        {{for(i=1;i<=${count};i++)}}
        <tr></tr>
        {{/for }}
     </tbody>
    </table>
</script>

But by doing the above implementation in the templates, the tmpl library throws “Template command not found” error.

Can anyone suggestion solution to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:58:17+00:00Added an answer on June 13, 2026 at 11:58 am

    You could try this:

    {{each(i) Name}}
        {{if i < count}}
            <tr></tr>
        {{/if}}
    {{/each}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider following 2 programs giving same error First calss: public class Testing { Testing
Consider the following function using jQuery: function getVal() { jQuery.get('/relative/url/', function (data) { return
To paint a scenario, consider the following logic-omitted-Service public class Service { private Validator
Consider the following code: $(.lcontainer a).click(function () { var current = $(this); var name
Consider the following table with a constraint that's a bit daft but simple enough
Consider the following piece of code: <html><head></head> <body> <script type=text/javascript> var outside_scope = outside
Consider the following Java code: try{ // do something // this piece of code
Consider the following tables : drop table if exists testA; drop table if exists
Consider the following code: template<size_t head,size_t ... Dims> struct make_vec { typedef typename make_vec<Dims...>::type
Consider following make: all: a b a: echo a exit 1 b: echo b

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.