jQuery Template Plugin

jQuery template plugin allows you to render template items into HTML DOM, template items are HTML markup or text. Basically, we can define HTML markup with template variables and replace these variables inside the DOM when you get the data from an Ajax call or local static data.

Here is the simple example to display name and email list from static data.

 lang="html"]


    
    


 
    
Name Email

See the below output from above code:

Name Email
Name1 a@email.com
Name2 b@email.com
Name3 c@email.com
Name4 d@email.com

It will replace the template variables (${name},${email) with actual data and inject the markup into the table body.
In the above example, we defined the data locally, but in reality this should get by using an Ajax request to a page or remote service.

See more examples and documentation here:
http://api.jquery.com/category/plugins/templates/
http://api.jquery.com/jquery.tmpl/
https://github.com/jquery/jquery-tmpl

Note: This feature and its documentation are in beta and subject to change before final release.

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami