Embedding a script with a jsrender template-Collection of common programming errors
I would like to use a variable from my jsrender template in order to produce a snippet of javascript, but I can’t figure out how to place a within my
Hopefully the below is fairly clear. The below code produces an Uncaught SyntaxError
. If I remove the tags from the embedded script, then it is simply printed onto the page as text.
In the code below, I am trying to generate a div with the id ‘chartId’, and then a script which will fill that div with content, via the MyChart object.
- {{for graphs}}
{{html:graphTitle}}
{{html:value}}
{{/for}} var chartObj = new MyChart(“{{html:chartId}}”); chartObj.render();
...