jQuery Templates
March 22, 2008 - 6:53am — stosh1985
Similar to the macro-based templates in the popular javascript library Ext, jQuery templates offer ways of creating html chunks and applying an object of attributes to them via the jQuery DOM manipulation methods. Variable types default to JSP-style, however they can be customized to other variable styles for the plugin as well as for individual template objects. Via helper methods, variable functions can be applied to variables within the templates as well.
Example:
var t = $.template('<div id="foo">Hello ${name}, how are you ${question}? I am ${me:substr(0,10)}</div>');
$(selector).append( t , {
name: 'Stan',
question: 'feeling',
me: 'doing quite well myself, thank you very much!'
});Releases
| Official releases | Date | Size | Links | Status | |
|---|---|---|---|---|---|
| 1.0.0 | 2008-Mar-22 | 7 KB | Recommended for 1.2.x | ||