jquery - oprating on single single quote in javascript and html -
this question has answer here:
- escape quotes in javascript 11 answers
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
Post a Comment