I have a piece of javascript code as follows:
var data = { ... };
var template = "<select>" +
"<option value='${0:###,###.##}'>Format as $</option>" +
"</select>";
$.tmpl(template, data).appendTo("#placeholder");
My problem is that I want to evaluate the "value='${0:###,###.##}'" as a string, but jQuery templates attempts to evaluate it as an object reference.
Is there a way to escape the ${} characters?
Cheers, Shane
Try to replace $ with its special HTML character $
var data = { };
var template = "<select>" +
"<option value='${0:###,###.##}'>Format as $</option>" +
"</select>";
$.tmpl( template, data).appendTo("#placeholder");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With