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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:48:15+00:00 2026-05-27T12:48:15+00:00

I am using jQuerys tmpl plugin for templates. Now i have an array with

  • 0

I am using jQuerys “tmpl” plugin for templates. Now i have an array with elements that are arrays as well and i have to access specific elements.

i.e. the array would be:

var arr = {
  'id':23422,
  'title':'example',
  'images': {'small':'34fge.jpg','original':'dfsdf354.jpg'}
};

And now in the temple i’d like to access arr[images][small] but it doesn’t work. What i am trying is:

<div>
  <h3>${title}</h3>
  <img src="${arr}{images}{small}" />
</div>

Anyone any help/ideas?

  • 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-27T12:48:15+00:00Added an answer on May 27, 2026 at 12:48 pm

    Use <img src="${images.small}" /> that will give the following markup:

    <div>
      <h3>example</h3>
      <img src="34fge.jpg">
    </div>
    

    In fact, the images property isn’t a nested array but a object with properties.

    But if you really want to loop through a nested array, then you should use a nested template and change your syntax a little bit (note the [] around images property):

    Javascript

    var arr = {
        'id': 23422,
        'title': 'example',
        'images': [
            { 'small': '34fge.jpg', 'original': 'dfsdf354.jpg' },
            { 'small': '35fge.jpg', 'original': 'dfsdf.jpg' }
        ]
    };
    

    Templates

    <script id="template" type="text/x-jquery-tmpl">
       <div>
         <h3>${title}</h3>
         {{tmpl(images) "#imagesTemplate"}}
       </div>
    </script>
    <script id="imagesTemplate" type="text/x-jquery-tmpl">
         <img src="${small}" />
         <img src="${original}" />
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that jquery's beta template plugin is using, the type attribute text/x-jquery-tmpl e.g
I'm using jQuery Templates from within the jQuery UI Autocomplete plugin so that I
I have an issue using jquerys selectors when it comes to a page I
Using jQuery, is there a way to select all tag that reference a specific
Im using JQuerys Autocomplete plugin, but it doesn't autocomplete upon entering anything. Any ideas
I'm currently generating a list using the jQuery tmpl plugin : <script id=mainTemplate type=text/x-jquery-tmpl>
I'm appending rows to a table using the jQuery tmpl plugin. Each row corresponds
I'm trying to implement more/less functionality using the official jquery-tmpl plugin. I've looked at
I have a simple webpage that uses the jquery template plugin to dynamically load
I have a Json object that I'm dumping into a jQuery template (tmpl). It

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.