The other character within a string no need to escape. In the HTML we use double-quotes and in the JavaScript single-quotes, so any quotes within the JavaScript code will need to be escaped so that they don't conflict with ⦠Les caractères spéciaux, sauf @*_+-./, seront encodés. I have a requirement to escape any single quote in given string . It's likely you'll use double quoted strings with escape sequences to use their translated meaning, a newline or a tab. Special characters are encoded with the exception of: @*_+-./. The escape function is a property of the global object. Escape quotes in Javascript - Java2Blog Thanks for the reply Scott --. Escaping string literals. Escape quotes in JavaScript (8) " would work in this particular case, as suggested before me, because of the HTML context. If you just want to escape string literals, here are the ways to do it. This would look like this: . The simplest method to escape single quotes in SQL is to use two single quotes. escape single quotes If you use PHP, you can use addslashes () prior to inserting into JavaScript. How to escape single quote in sed
javascript escape single quote in variable