简体   繁体   English

如何在新标签页中打开jQuery定义的链接

[英]how to open a jquery defined link in a new tab

How do I open this link to open in a new tab. 如何打开此链接以在新标签页中打开。 None of the other question asked seem to specify how to mesh this with the target of the link being defined in the JS file. 提出的其他问题似乎都没有指定如何与JS文件中定义的链接目标啮合。 Please help! 请帮忙!

HTML: HTML:

<div>
    <p><span id="popUpMoreLink">Contact Me</span></p>
</div>

JS: JS:

$('#popUpMoreLink').click(function () {
    window.location = 'mailto:exmpl@gmail.com?Subject=Inquiry';
});

window.open() will fire up a new window. window.open()将触发一个新窗口。

$('#popUpMoreLink').click(function () {
    window.open('mailto:exmpl@gmail.com?Subject=Inquiry');
});

but since the link is a "mailto:" (it opens thunderbird / outlook / whatever mail client is installed on the client's system) I'm not sure what you're trying to achieve. 但是由于链接是“ mailto:”(打开雷鸟/ Outlook /客户端系统上安装的任何邮件客户端),所以我不确定您要实现的目标。

您是否尝试过window.open('mailto:')?

Got it! 得到它了!

Instead of 代替

window.location window.location

it is 它是

window. 窗口。 open 打开

$(function(){
  $('#popUpMoreLink').click(function() {
    window.open('mailto:exmpl@gmail.com?Subject=Inquiry');
  });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM