Anything similar to EOD heredoc definitions in Javascript?
optik
2:16 pm on Jul 6, 2009 (gmt 0)
Hi
When defnining a variable in PHP you can avoid using slashes on every quote by using i=<<<EOD value EOD;
is there anything similar in javascript or is escaping quotes the only way?
whoisgregg
7:36 pm on Jul 8, 2009 (gmt 0)
Not in the code directly, but you could store the data in a hidden input or div and access it's value or .innerHTML (respectively) if you have a really long bit of text/html to write.
There are some hacky ways of doing it with comments, but nothing I've seen is reliable across browsers.
optik
10:21 pm on Jul 8, 2009 (gmt 0)
ok I'll probably stick with escaping quotes
DrDoc
11:06 pm on Jul 8, 2009 (gmt 0)
Or, singlequote the string itself ... that way you do not have to escape all doublequotes.