jquery - oprating on single single quote in javascript and html -


this question has answer here:

i have asked question before , it's simple question still waiting answer.

i want string containing "'" single quote.

i know can use double single quote evade problem don't want use double single quotes.

is there solution can use single quote in javascript. saving value single quote in cookies , operating on in javascript.

its simple functionality don't know why developer community not know simple solution it

update: don't want use slash since don't have access string source

you can use \ escape character:

this valid code:

var teststring = 'this could\'ve gone wrong, didn\'t'; 

you can replace them line:

strinputstring = strinputstring.replace(/'/g, "\\'"); 

this escape existing single quotes you.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -