[Solved] JavaScript String Handling


Your question seems to be more about PHP than Javascript, based on the code snippet you provided. Basically, you might want to escape the apostrophes with a backslash character.

onclick="(method('<?php echo $variable; ?>'))"

would then become something like this perhaps:

onclick="(method('<?php echo addslashes($variable); ?>'))"

… and please remove the parenthesis you have surrounding the onclick event, like so:

onclick="method('<?php echo addslashes($variable); ?>')"

solved JavaScript String Handling