Escape characters to be used in a javascript literal string -


i take string user enter text box in form , turn javascript literal. i'd, instance, turn " character \".

is there complete list of characters need escaped?

you need escape delimiter and/or whatever enclosing quotes choose (escape double quotes if enclose string in double, escape single otherwise).

if you're going render html, may wnat convert them entities (e.g. & -> &)


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -