Handle template with a div tag instead of a script

Actually the question is in subj ... Is it possible to create the structure of pen templates, recognize patterns in the div tag, and not in the script tag?

For example, I would like to create a template with this markup:

<style>
    div.text-x-handlebars {display:none;}
</style>
<div class="text-x-handlebars-template">
    <h2>I'm template</h2>
    <p>{{welcomeMessage}}</p>
</div>
+3
source share
1 answer

Yes, you can place your templates in <div>instead of <script>s, for example:

http://jsfiddle.net/ambiguous/RucqP/

, . <div>, HTML, ; , HTML , , . , id , id ( <div> , DOM), . <div>, ( , , , , src),.

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

+5

All Articles