javascript - Dynamically alter an underscore template for Backbone -


i'm using backbone underscore templates defined in html so:

<script type="text/template" id="edittemplate">     <select id="scred" class="scredselect">         <!-- options -->     </select> </script> 

and assigned backbone view template (via coffeescript) this:

template: _.template $("#edittemplate").html() 

everything working intended. however... dynamically add options select scred.

i've tried access scred select via $("#edittemplate").find('.scredselect'), of course, since inside of script tags not treated html, selector doesn't work.

i can access element so...

html = $("#edittemplate").html() $(html).find('.scredselect').dostuff() 

is there easier way accomplish this? or task better suited full blown templating engine handlebars or mustache?


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -