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 8860963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:23:03+00:00 2026-06-14T15:23:03+00:00

I am reading and trying to understand a Jquery template example. <script id=movieTemplate type=text/x-jquery-tmpl>

  • 0

I am reading and trying to understand a Jquery template example.

<script id="movieTemplate" type="text/x-jquery-tmpl"> 
  {{tmpl "titleTemplate"}}
  <tr class="detail"><td>Director: ${Director}</td></tr>

</script>

<table><tbody id="movieList"></tbody></table>

<script>
var movies = [
  { Name: "The Red Violin", Director: "François Girard" ,Producer : "ssss" },
  { Name: "Eyes Wide Shut", Director: "Stanley Kubrick" },
  { Name: "The Inheritance", Director: "Mauro Bolognini" }
];

/* Convert the markup string into a named template,
   referenced by the {{tmpl}} tag */
$.template( "titleTemplate", "<tr class='title'><td>${Name}</td></tr>" );

/* Render the movies data, using the named template as a nested template */
$( "#movieTemplate" ).tmpl( movies ).appendTo( "#movieList" );
</script>

In this example program I am not able to understand about the:

/* Convert the markup string into a named template,
referenced by the {{tmpl}} tag */

when we call:
$( “#movieTemplate” ).tmpl( movies ) it is calling the template on that we are calling the template function with input movies and appending that to movieslistid

if I remove the code

$.template( "titleTemplate", "<tr class='title'><td>${Name}</td></tr>" );

it does not work. Can you please explain why we need this and what is it doing here like what does: /* Convert the markup string into a named template, mean and all..

I tried to readonline and found that I am not getting this clarified

  • 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-14T15:23:04+00:00Added an answer on June 14, 2026 at 3:23 pm

    This contains a reference to a template named "titleTemplate", a template which has not yet been defined:

    <script id="movieTemplate" type="text/x-jquery-tmpl"> 
      {{tmpl "titleTemplate"}}
      <tr class="detail"><td>Director: ${Director}</td></tr>
    </script>
    

    This line defines that missing template:

    $.template( "titleTemplate", "<tr class='title'><td>${Name}</td></tr>" );
    

    It is another way of saying

    <script id="titleTemplate" type="text/x-jquery-tmpl"> 
      <tr class='title'><td>${Name}</td></tr>
    </script>
    

    In essence the example shows that you can define templates in two ways

    • declaratively in the HTML source code, as <script type="text/x-jquery-tmpl"> elements
    • programmatically from strings through $.template()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to understand how to use Type Converters after reading this answer to
I'm trying to understand how ID3 tags work, so, after reading some documentation, I
I'm reading a logcat now, trying to understand why 2 devices couldn't connect via
I'm reading Dive into Python, especially trying to understand the examples, and I had
I'm reading through and trying to understand some verilog, and sprinkled through is the
I am trying to understand quartz 2d coordinate system, Currently I am reading Apple
So I'm trying to understand IQueryable<T> . A tutorial I'm reading suggests using it
I've been reading about ThreadLocal, trying to understand how it works and why we
I am trying to understand different ways of reading and writing files with their
I'm trying to understand the Linux kernel, so I'm reading Linux kernel source. So

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.