jQuery 1.4.x and the @ symbol

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-04-14T06:00:27Z Indexed on 2010/04/14 6:03 UTC
Read the original article Hit count: 333

Filed under:

I used to use this script for jquery email obfuscation:

    $(".replaceAt").replaceWith("@");
  $(".obfuscate").each(function () {
        $(this).attr("href", "mailto:"+$(this).text());
    });

<a class="obfuscate">name<span class="replaceAt">-AT-</span>server.com</a>

But with jQuery 1.4.x, I now get this error:

uncaught exception: Syntax error, unrecognized expression: @

Looking this up on the net, it looks like jQuery thinks that the @ is a special character. I tried to "\@" it and a few other things with not luck. I'm not enough of a jQuery ninja to know how to fix this. Any ideas?

© Stack Overflow or respective owner

Related posts about jQuery