Search code examples
jqueryjquery-templates

jquery templates: How to create a template for unknown type


I just started looking at the jquery-tmpl and was wondering if it would be possible to create a template that would render an unknown type. Basically a generic template that would take a JSON object and render all of values found on the object?


Solution

  • Use the each template tag

    {{each(key, value) jsonObject}}
      <p>${key}: ${value}</p>
    {{/each}}