Is there a way with javascript to automatically have the page look for any mailto links and then have it fire off an alert when a user clicks on the mailto link?
I currently have this:
HTML:
<a href="mailto:nachomomma@notyourdomain.com">Email Link</a>
Javascript:
$(document).on('click','mailto',
function() {
alert('This is some alert text');
});
But that doesn't seem to work. Not too sure if I am going about this the correct way or if it's even possible.
You need to use an actual selector, such as a[href^="mailto"]