Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created April 30, 2015 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linus-amg/16dcc546d9ed30c5cbf4 to your computer and use it in GitHub Desktop.
Save linus-amg/16dcc546d9ed30c5cbf4 to your computer and use it in GitHub Desktop.
var render = function render(tplEl, htmlEl, context) {
var template = Handlebars.compile($(tplEl).text());
context = context || {};
return $(htmlEl).html(template(context));
};
render('#tpl-demo', '#doc', { name: 'John Doe' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment