Reputation: 595
I'm not sure what characters need to be escaped in my string. My PHP code is giving the string parameter, but sometimes it has quotes and double quotes that I'm not sure what to do with.
onclick="eventBox('This is the string ' // " "')"
Upvotes: 1
Views: 1345
Reputation: 50493
You will need to escape the quotes or encode them so it parses correctly.
onclick="eventBox('This is the string \' // " "')"
Otherwise there will be a parse error because of mis-matching quotes
Upvotes: 1
Reputation: 143099
quotes ("
) should be replaced with "
. And backslash (\
) prepended to '
.
onclick="eventBox('This is the string \' // " "')"
Upvotes: 4