4

I'd like to include some html in a jTemplate variable - e.g.

<td class="numeric">{$T.total_price}</td>

Where total_price is:

"$12<span>.00</span>"

Is there any way I can get the span to show up as html?

EoghanM
  • 25,161
  • 23
  • 90
  • 123

2 Answers2

8

I got it with:

$('#mhid')setTemplate(s, [], {filter_data: false});
EoghanM
  • 25,161
  • 23
  • 90
  • 123
  • +1 Thank you @EoghanM, this worked perfectly - substituting '***s***' above with the template name I was using. If I am honest, I don't find 'http://jtemplates.tpython.com' very good on the documentation side of things. Do you have any references for jTemplate? Many thanks. – Anthony Walsh Apr 03 '13 at 16:48
0

I am having the same problem:

Template:

   <textarea id="pagination" style="display:none"><b>pagination</b></textarea>

If I call the template as:

$('').setTemplate($('pagination').html(),[],{filter_data: false});

$('').processTemplate();

Its not working. its displaying as:

<b>pagination</b>

If I call the same template by using setTemplateElement like:

$('').setTemplateElement('pagination');

$('').processTemplate();

Its working. its displaying as: pagination

Dilip Rajkumar
  • 7,006
  • 6
  • 60
  • 76
Vallabha Vamaravelli
  • 1,153
  • 1
  • 9
  • 15
  • I know this is an old post, but in my case it works perfectly with the solution that @EoghanM has given. My template was referenced by: `$('foobar').setTemplateElement("pagination", [], { filter_data: false });`. Note the textarea 'id' in quotes: "pagination", and not '$('pagination').html()' as you have above (you are missing a # here too BTW). Have a look at http://jtemplates.tpython.com in the FAQ page at the top. I hope this helps someone. – Anthony Walsh Apr 03 '13 at 17:10