How to click a mailto link in JQuery

If you have a mailto link on the page and you want to invoke a click event using JQuery you can use the following code snippet.

Suppose here is the link

<a id='mylink' href="">Email</a>

Use following JQuery code for invoking click event on the above link 

$("#mylink").bind('click', function () {
   window.location.href = $(this).attr('href');




About author

User avatar

Waqas Anwar

Founder of, Senior Consultant, Microsoft .NET and Web Technologies