So I have a PHP code that generates a portion of HTML/JavaScript code like below:
$link = '<a href="javascript:void(0);" class="btn btn-read btn-flat" onclick="showLoginLightBox(0,2);">Click Here</a>';
This works fine, but I want to replace the second parameter “2” with a text. So I have tried:
$link = '<a href="javascript:void(0);" class="btn btn-read btn-flat" onclick="showLoginLightBox(0,"active");">Click Here</a>';
This just gives me an error saying SyntaxError: invalid escape sequence
I have many combinations '
and "
and others but nothing works. Can someone help me here?
Advertisement
Answer
In HTML you can use "
instead of "
and '
instead of '