Question

I'm using a clearsilver variable as a parameter to a javascript function, from an href. Like this:

<a href="javascript:foo('<?cs var: js_escape(bar) ?>');"><span>

This works great, until the cs variable contains quotes.

Anyone have experience with this? Is there some ordering of escaping that will work for this, or do I need to find a variable that doesn't have quotes in it?

Was it helpful?

Solution

Did some more testing, this works:

<a href="javascript:foo('<?cs var: html_escape(js_escape(bar)) ?>');">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top