I am tying to store ":;',./<>?,./asdaA12
value in js variable which is in gsp page but it could'nt store it properly and gives me run-time error because of special symbol contain "
and '
as string.
my snap code is :
var editGrp_billingCode_val ="${returnVal?.groupCommand?.billingCode?:billingCode?:billingCode}";
Here Billing code populate with : ":;',./<>?,./asdaA12
value which contain " or ' symbols so for that page gives me run-time js error
is there any one solution for converting this types of string into String variable and store into js variable. like toString method in java
Value ":;',./<>?,./asdaA12 is not fixed it will come dynamically while running the application so i have to convert it at run-time as stored in js variable
By escaping them:
Short escaping list:
"
=\"
or'
=\'
\
=\\
\n
\t
more: w3schools - JavaScript Strings