JSFiddle - React, Tailwind, and code Playground
by Anirudh Tewathia
HTML
<div class="wrapper">
<a href="http://google.com">This works fine.</a>
<a href="mailto:[email protected]">This email mailto: does not.</a>
</div>
JavaScript
function fadeAndGo(x) {
$(x).click(function (e) {
e.preventDefault();
var href = this.href;
if (href.indexOf('mailto') == -1) {
$('.wrapper').fadeOut(function () {
alert('Normal Link');
window.location = href;
});
} else {
alert('mailto Link');
}
});
}
fadeAndGo('a');