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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:39:34+00:00 2026-05-18T04:39:34+00:00

Hey guys, i’m trying this example from Dave Ward blog about jQuery Templates and

  • 0

Hey guys, i’m trying this example from Dave Ward blog

about jQuery Templates and something i’m doing wrong.
Any help will be appreciated.
Here’s his code:
Data:

 var invoice = {
  invoiceItems: [
    { type: 'item', 
      part: '99Designs', description: '99 Designs Logo', 
      price: 450.00, qty: 1 },
    { type: 'service',
      service: 'Web development and testing', 
      price: 25000.00 },
    { type: 'item',
      part: 'LinodeMonthly', description: 'Monthly site hosting', 
      price: 40.00, qty: 12 }
  ]
};

Client:

  <script id="invoiceTemplate" type="x-jquery-tmpl">
      <table class="invoice">
      {{each lineItems}}
        {{tmpl($value) get_invoiceRowTemplateName(type)}}
      {{/each}}
      </table>
  </script>

Js:

$(function ()
{
    $('#invoiceTemplate').tmpl(invoice).appendTo('body');
});

function get_invoiceRowTemplateName(type) {
  // Return a template selector that matches our 
  //  convention of <type>RowTemplate.
  return '#' + type + 'RowTemplate';
}
  • 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-18T04:39:35+00:00Added an answer on May 18, 2026 at 4:39 am

    Don’t forget the row templates:

    <script id="serviceRowTemplate" type="x-jquery-tmpl">
      <tr class="service">
        <td colspan="2">${service}</td>
        <td colspan="2">${price}</td>
      </tr>
    </script>
    
    <script id="itemRowTemplate" type="x-jquery-tmpl">
      <tr class="item">
        <td>${item}</td>
        <td>${description}</td>
        <td>${price}</td>
        <td>${qty}</td>
      </tr>
    </script>
    

    When get_invoiceRowTemplateName() resolves each item’s type to the corresponding *type*RowTemplate, those individual row templates are what is used to render each item.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys i dont know what i'm doing wrong here. www.example.com/data/stuff1/stuff2/stuff3 to www.example.com/anything.php?par1=data&&par2=stuff1/stuff2/stuff3 And
Hey guys plz help I am trying to convert this html to jade using
Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
hey guys having this really simple problem but cant seem to figure out have
Hey guys am having a bit of problems with my jQuery, I have all
Hey guys I've written this MS SQL script with my awesome MS SQL skills,
hey guys I have the follow code in js: $(document).ready(function(){ $(.replyLink).click(function(){ $(#form-to-+this.id).html(htmlForm()).toggle(500); return false;
Hey guys I have about 8 fieldSets and Im iterating over a list. I
Hey guys i want to use the jquery Autocomplete plugin and instead of separating
Hey guys I'm trying to add the string 'url( ) ' around my a

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.