Friday, 15 May 2015

html - use a script tag for a javascript template instead of a string -



html - use a script tag for a javascript template instead of a string -

so i've seen handlebars templates this:

<script id="some-template" type="text/x-handlebars-template"> </script>

and wondering if there's way utilize underscore.js templates this. nice have templates in markup instead of sitting within string.

sure, can easily.

var templatetext= document.getelementbyid('some-template').innerhtml;

javascript html templates underscore.js

No comments:

Post a Comment