jogx
jogx

Reputation: 75

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. Please help!

HTML:

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

JS:

$('#popUpMoreLink').click(function () {
    window.location = 'mailto:[email protected]?Subject=Inquiry';
});

Upvotes: 0

Views: 178

Answers (3)

GrafiCode
GrafiCode

Reputation: 3374

window.open() will fire up a new window.

$('#popUpMoreLink').click(function () {
    window.open('mailto:[email protected]?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.

Upvotes: 1

jogx
jogx

Reputation: 75

Got it!

Instead of

window.location

it is

window.open

$(function(){
  $('#popUpMoreLink').click(function() {
    window.open('mailto:[email protected]?Subject=Inquiry');
  });
});

Upvotes: 0

victorfern
victorfern

Reputation: 46

Did you tried window.open('mailto:')?

Upvotes: 1

Related Questions