Escape quotes in JavaScript

前端 未结 13 785
不思量自难忘°
不思量自难忘° 2020-11-22 11:39

I\'m outputting values from a database (it isn\'t really open to public entry, but it is open to entry by a user at the company -- meaning, I\'m not worried about XSS).

13条回答
  •  孤独总比滥情好
    2020-11-22 12:01

    You can use the escape() and unescape() jQuery methods. Like below,

    Use escape(str); to escape the string and recover again using unescape(str_esc);.

提交回复
热议问题