$( function () { $("a[@href^=mailto]").click(function() { if (this.href.match("(dot)")) { if (prompt("Are you a person (yes or no)?", "no") == "yes") this.href = this.href.replace(/\(dot\)/g, ".").replace(/\(at\)/g, "@"); } })});