173
rated 0 times
[
179]
[
6]
/ answers: 1 / hits: 60050
/ 11 Years ago, fri, march 22, 2013, 12:00:00
JSP:
<% final String data = some test with ' single quotes; %>
<script>
var str = '<%= data %>';
<script>
The result is (JavaScript):
var str = 'some test with ' single quotes';
Uncaught SyntaxError: Unexpected identifier
How do I replace this single quote with '
to avoid a JavaScript error?
More From » java