Saturday, 15 August 2015

javascript - backbone template won't stay in html -



javascript - backbone template won't stay in html -

so have backbone template i'm inserting in html:

<div class = "outside of template"> <script id="persontemplate" type="text/template"> <div class="view1"> <input class="toggle" type="checkbox"> <input class="view" style="border:none;" value="<%= name %> <%= age %> - <%= occupation %>"> <a class = "destroy" /> </div> </script> </div>

but when run script/ open page, output of template appear underneath

<div class = "outside of template"></div>

so how can create template contents remain within html div or table or whatever element?

your template appears between div element. that's issue right there.

it has be:

<div class = "outside of template"></div> <script id="persontemplate" type="text/template"> <div class="view1"> <input class="toggle" type="checkbox"> <input class="view" style="border:none;" value="<%= name %> <%= age %> - <%= occupation %>"> <a class = "destroy" /> </div> </script>

javascript html templates backbone.js

No comments:

Post a Comment