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="mailto:waqas@ezzylearning.com">Email</a>

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

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

$("[id$='_lnkTDEmailAddress']").click();

 

 

About author


User avatar

Waqas Anwar

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

Comments