我在jquery中有一个按钮单击事件,在该事件中,我想在单击它时启动我的邮箱,并单击它,并将特定文本作为邮件正文存储在变量中。

以下是我的代码:

$('#myButton').click(function(){

         $('#btnLaunchEmail').hide();
         if (strExternalZippedLink.trim() != '') {
             //Here I have to initiate the email
         }

})


我尝试了很多事情但没有奏效。谁能帮忙。

最佳答案

尝试以下代码:

   if (strExternalZippedLink.trim() != '') {

                //Lunching the email
                var aLink = document.createElement('a');
                aLink.href = 'mailto:?body=' + strExternalZippedLink;
                aLink.click();
            }


strExternalZippedLink将显示在正文中

09-25 22:24