I have a string like this:
var cadena = '<form name="name" th:action=" 'ERROR' ">';
I have a single quote inside the string and it is what limits the beginning and the end, how can I do to include the escape characters as part of the string?
All the best.
To escape your single quotes you will have to escape them with
\
. Staying as follows:You can use the template strings to include single quotes, in addition to having other features such as text strings of more than one line, they are used with backtips or backticks `, I leave a link so you can learn more about it https:// developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings