mustache js how to use partials in html
example you have these in your html:
<script type="text/html" id="ul-template">
<ul id="list">
{{> li-templ}}
</ul>
</script>
<script type="text/html" id="ul-template2">
<div id="list2">
{{> li-templ}}
</div>
</script>
<script type="text/html" id="li-templ">
<p>{{ name }}</p>
</script>
Here's some jQuery to do just that:
var view = {"name" : "You"},
li = $('#li-templ').html(),
partials = {"li-templ": li},
ul1 = Mustache.to_html($('#ul-template').html(), view, partials),
ul2 = Mustache.to_html($('#ul-template2').html(), view, partials);;
document.write(ul1, ul2);
Also in HTML:
- calling function on click html
- comment html
- Could not find a required file. Name: index.html
- datatable pdfHtml5 pagesize
- onclick a tag
- table html structure
- html color changing background
- TYPESCRIPT RETURN HTML ELEMENT
- list with bullets html
- html space tag
- html legend fieldset
- fetch html from url
- how to create a button with text in HTML5?
- color de las letras en html
- html grundgerüst
- how to bind the data in html table in java
- html add vertical space below
- how to stop download option in video tag of HTML
- reactive forms radio button
- take input date html
- iframe
- a column inside another column bootstrap html
- how to show a javascript variable in html
- javascript onclick alert are you sure