Textarea in spine and html underline decoding content
I am using backbone.js with underscore.js
In my template I have the following textbox
<textarea id="MyHtml" rows="10" cols="75" name="MyHtml"><%= MyHtml %></textarea>
Now the problem is my model MyHtml
has any ascii character that html decodes and processes. To know exactly what I mean, check the fiddle .
How do I use the above pattern and still discourage it?
+3
source to share
2 answers
You can insert escaped values via <%- … %>
See http://underscorejs.org/#template
You write
<textarea id="MyHtml" rows="10" cols="75" name="MyHtml"><%- MyHtml %></textarea>
+3
source to share