Reputation: 1415
I have this code:
<span onmouseout="tooltip.hide();" onmouseover="tooltip.show('Hello. This is a simple tooltip, I'm here if you need me, we've been away for some time.');" class="hotspot">test link</span>
the thing is that the SINGLE quote '
is causing the tooltip not to show... so I mean IF the text contains '
the tooltip will not show... because all the text is already inside single quotes...
Can someone please help me to fix this?
Upvotes: 0
Views: 369
Reputation: 3495
Use ’
for Special Characters in HTML.
<span onmouseout="tooltip.hide();" onmouseover="tooltip.show('Hello. This is a simple tooltip, I’m here if you need me, we’ve been away for some time.');" class="hotspot">test link</span>
I created Working Demo with
alert()
you can run this code snippet :)
<span onmouseover="alert('Hello. This is a simple tooltip, I’m here if you need me, we’ve been away for some time.');"
class="hotspot">test link</span>
Upvotes: 0
Reputation: 1415
Fixed this myself.
So I just replaced every instance of ' to \' in str_replace function :)
WAS:
$desc = str_replace('"', "", preg_replace('/(\s\s+|\t|\n)/', ' ', JFilterOutput::cleanText($regs[0])));
IS NOW:
$desc = str_replace("'", "\\'", preg_replace('/(\s\s+|\t|\n)/', ' ', JFilterOutput::cleanText($regs[0])));
Upvotes: 0
Reputation: 1585
Try setting the tooltip text to a var and then doing a replace on the single quote with '
var tooltip = tooltip.replace(/'/g, "'");
Upvotes: 1