How do I make this work?
<a href='javascript:func("Jack'S Birthday")'>Jack's Birthday</a>
Do as follows:
// How about using variables instead?
var emily = "Emily'S Birthday"
var birthdays = {
john: "John'S Birthday"
}
function func(val) {
console.log(val);
}
<!DOCTYPE html>
<html>
<body>
<a href='javascript:func("Jack'S Birthday")'>Jack's Birthday</a>
<br>
<a href="javascript:func('Norman\'S Birthday')">Norman's Birthday</a>
<br>
<a href="javascript:func(emily)">Emily's Birthday</a>
<br>
<a href="javascript:func(birthdays.john)">John's Birthday</a>
</body>
</html>
Explanation:
\
$apos;
Best of all, use variables, they ease a lot of pain -
a. You don't have to go into html to modify values,
b. these can be declared at one place, or a single file,
c. They can be fetched from back-end
d. Best yet, no need to deal with quotes!