I have a jquery function to hide email ids on the webpage to avoid spambots. I am trying to replace all the span tags with class 'mailme' to valid email ids with the help of this function. The code was working for 1 span tag but since its changed to multiple spans with the help of each method, its not working.
Html
<span class="mailme">myemail at mydomain dot com</span>
jQuery
$('span.mailme').each(function(){
var spt = "#" + $(this).attr("id");
var at = / at /;
var dot = / dot /g;
var addr = $(spt).text().replace(at,"@").replace(dot,".");
$(spt).after('<a href="mailto:'+addr+'" title="Send an email">'+ addr +'</a>')
.hover(function(){window.status="Send a letter!";}, function(){window.status="";});
$(spt).remove();
});
:)