I'm working on a plugin for my company's site. They have address on their site that go to outlook when clicked. I have my plugin concept I just need to grab the email from the link is clicked.
how can i use javascript/jquery to strip the url from the link and ignore the "mailto:"
how can i use javascript/jquery to strip the url from the link and ignore the "mailto:"
It's not super practical, but it separates the name from the extension to prevent bots from reading it.
psdo code:
What i'm trying to do now is get the email link:
<a href="mailto: user@provider.com">email me</a>
I want to pull out the "user@provider.com". I will never know what the email address is going to be so i cant search for a specific email either.
Look like i need to get the enter href (mailto: user@provider.com) then remove the mailto: part. Once i have that I can send it to a php driven form using http://www.site.com/contact.php?email=user@provider.com.
$('.mailto').click(function() {href = $(this).attr('href');
})
this is my test to see when i get the url whittled down to just the email address. so far it shows "mailto: user@provider.com"
$(function() {
$('a[href^=mailto]').addClass('mailbox');
$('.mailbox').click(function()
{
var url = $(this).attr('href');
url = url.replace(/mailto: /, '');
alert(url);
return false;
});
});