I have a string with a ' inside it:
<a href="#" onclick="if (confirm('... ' ...')) { document.exampleFormName.submit(); }">example link text</a>
Unfortunately this does not seem to work. Firebug says "SyntaxError: missing ) after argument list" and you can see that the HTML entity has already been replaced by '.
What can I do to avoid this problem?
Try this
<a href='#' onclick='if (confirm("... ' ..."))
{
document.exampleFormName.submit();
}'> example link text
</a>
Because "#039" stands for single quote so ('...'...') in your previous code would fail because of this reason