It is picking up the spaces on either side of the email address and they end up each encoded as %20
There are a couple of ways to fix it.
1. Simply get rid of the spaces so that the email address ins the only thing inside the tad.
2. trim() the leading and traimilg spaces from the calue before splitting it into individual characters. Modern browsers support the trim() method on strings but depending on which older browsers you want to support you may need to implement your own.
Code:
<a href="#" onclick="this.href='mailto:'+ this.innerHTML.trim().split('').reverse().join('')" style="unicode-bidi:bidi-override; direction: rtl;">
moc.niamod@liame
</a>
and to define trim for those browsers where it doesn't exist simply add the following JavaScript.
Code:
if (!String.trim) {
String.prototype.trim = function() {
return this.replace(/^\s*(.*?)\s*$/,"$1");}
}
Alternatively you could just use the replace instead of trim:
Code:
<a href="#" onclick="this.href='mailto:'+ this.innerHTML.replace(/^\s*(.*?)\s*$/,"$1").split('').reverse().join('')" style="unicode-bidi:bidi-override; direction: rtl;">
moc.niamod@liame
</a>
Bookmarks