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

  • Home
  • SEARCH
  • 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 6557737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:06:46+00:00 2026-05-25T13:06:46+00:00

Using jQuery templates is easy for some simple data structures. <script type=jquery/x-jquery-tmpl id=myTemplate> <li>

  • 0

Using jQuery templates is easy for some simple data structures.

<script type="jquery/x-jquery-tmpl" id="myTemplate">
  <li> ${Element} </li>
</script>

var elements = [
   { Element: "Hydrogen" },
   { Element: "Oxygen"   },
   { Element: "Nitrogen" }
];

$("#elementsPlaceholder").replaceWith($("#myTemplate").tmpl(elements));

But if I need a template for more complex data? Something like:

<script type="jquery/x-jquery-tmpl" id="myTemplate">
  <div> ${Molecule} </div>
  consists of:
  <ul>
      <li> ${Element} </li>
  </ul>
</script>

How can apply data to that? Is it possible? Could you show me an example?

  • 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-05-25T13:06:47+00:00Added an answer on May 25, 2026 at 1:06 pm
    <ul>
        <li> ${Element} </li>
    </ul>
    

    should use {{each}}

    <ul>
      {{each Elements}}<li>${$value.Element}</li>
    </ul>
    

    and then you pass in both the molecule and the elements

    $("#elementsPlaceholder").replaceWith($("#myTemplate").tmpl({
      Molecule: ...
      Elements: [{ Element: "Hydrogen" }, ...]
    }))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently generating a list using the jQuery tmpl plugin : <script id=mainTemplate type=text/x-jquery-tmpl>
After loading a PHP template (using jQuery's load function), this simple script won't make
I've been using the jQuery tmpl library for some projects and really liking it.
I'm building some <table> data dynamically using jQuery, but I'm getting the following error:
I am using Jquery templates to display incoming JSON data I would like to
Using jquery how do I focus the first element (edit field, text area, dropdown
Using jQuery, what's the best way to find the next form element on the
I am using jQuery Templates successfully but I have a blur function that is
I am using JQuery Templates to render a number of tables from a JSON
I am using jQuery templates and the dataTables plug-in to create grids in my

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.