Forum Moderators: open
function doSomething(t) {
alert(t);
}
doSomething("this \(is my\) textvalue");
From PHP or perl, the server side language will interpret the escape so on output you still get
function doSomething(t) {
alert(t);
}
doSomething("this (is my) textvalue");
Which will error. So what you want is to "escape the escape" from your server side language,
function doSomething(t) {
alert(t);
}
doSomething("this \\(is my\\) textvalue");
so the \ remains in your output.
Same is true of newlines you want to be interpreted by Javascript. \\n, not \n.