jQuery tmpl: How do I render Html?

user659025 picture user659025 · Apr 11, 2011 · Viewed 18.9k times · Source

Okay, I'm in a sitiuation with jQuery, the tmpl-plugin and this:

${$value.Text}

This is okay and works fine but as I just found out via the documentation:

Using {{html fieldNameOrExpression}} is equivalent to using ${fieldNameOrExpression}, except that it renders unencoded text into the HTML DOM, whereas ${} encodes values by default.

Okay fine. But I can't get the {{html}} tag to work with my ${$value.Text}.

I tried things like {{html ${$value.Text}} or {html ${$value.Text}} but it just doesn't work.

Answer

David Tang picture David Tang · Apr 11, 2011

The correct syntax is:

{{html $value.Text}}