You can escape the quote with a backslash..
fomateName('Andrew D\'souza');
This should work anyway:
var name = "Andrew D'souza";
fomateName(name);
Try:
<a onClick="fomateName('Andrew D\'souza')"> <!-- this will work -->
\
use backslashes to escape '
Lets say if you have function like this =>
function fomateName(txt){
alert(txt);
}
and invoking it from anchor =>
<a onClick="fomateName('Andrew D\'souza')"> <!-- this will alert "Andrew D'souza" -->
Escape the quote with backslashes.
<a onClick="fomateName('Andrew D\'souza')">
//this is not working ,because present of single quote
You can use escape character
<a onclick="formateName('AdrewD\'souza')">
Try this. Use backslash
- It will escape the quote breaks
<a onClick="fomateName('Andrew D\'souza')">
You can wrap it in double quotes like so:
<a onClick="fomateName("Andrew D'souza")"> //this is not working ,because present of single quote
Never mind, just realized it already has double quotes, yeah use backslash for escape like so:
<a onClick="fomateName('Andrew D\'souza')">