Can't run html on text string in JQuery tmpl -
in jquery template in project, trying write out variable html string without encoding html. when output variable so:
${description} it results in raw html string beingness outputted tags , so:
<p>text <b>bold</b> <i>italic</i></p> but when seek turn markup real tags @ same exact place in code:
{{html $description}} doesn't output anything!
i tried zillion ways of passing in variable, think there's going on in html routine i'm not getting.
thanks.
update:
here's how it's beingness called:
this.$el.attr('data-id', tmpldata.id). data('id', tmpldata.id).html($.tmpl(this.template, tmpldata)); where this.template template file , tmpldata json includes $description , other variables needed.
another update:
{{html '<p>string</p>'}} does behave expected.
{{html $another_variable}} fails produce output when $another_variable doesn't have html in it.
another update:
i tried:
${$item.html(description)} and changed phone call template
this.$el.attr('data-id', tmpldata.id). data('id', tmpldata.id). html($.tmpl(this.template, tmpldata, { truncate: _.truncatestrip, html: _.html, })); and wrote custom html routine pass through string unchanged recommended:
html: function(str) { homecoming str; } but still no dice.
the reply is:
{{html description}} i tried on, because left stray spaces within curly brackets, did not interpret properly.
:-(
jquery jquery-templates
No comments:
Post a Comment