0

i have this DOWNLOAD button

<a href="" id="user-name" class="link" id="posi">Download</a>

and the drop down associated with this

 <div class="user-name-drop-down drop-down">
        <a href="https://www.google.com">Android</a>
        <a href="https://www.google.com">Apple</a>

    </div>

when clicked on android or apple, it opens the link on the same tab, i want it to open in a new tab instead. i looked up about window.open but still unclear as to how to use that. any help is appreciated.

Shahsays
  • 421
  • 1
  • 7
  • 25

6 Answers6

1

you can do it by using attribute of <a> i.e target

<a href="https://www.google.com" target="_blank">Android</a>
        <a href="https://www.google.com" target="_blank">Apple</a>

you can refer this link.

Hope this might help you.

Abbas
  • 412
  • 2
  • 9
1
<div class="user-name-drop-down drop-down">
    <a href="https://www.google.com" target="_blank">Android</a>
    <a href="https://www.google.com" target="_blank">Apple</a>

</div>

use this code.

1
<div class="user-name-drop-down drop-down">
    <a target="_blank" href="https://www.google.com">Android</a>
    <a target="_blank" href="https://www.google.com">Apple</a>

</div>

Try this

Thanga
  • 7,811
  • 3
  • 19
  • 38
1

Use target = _blank as

<a target="_blank" href="https://www.google.com">Android</a>
<a target="_blank" href="https://www.google.com">Apple</a>
0

Simply you can use target="_blank" in your <a href="" ></a> tag.

<div class="user-name-drop-down drop-down">
   <a href="https://www.google.com" target="_blank">Android</a>
   <a href="https://www.google.com" target="_blank">Apple</a>
</div>
Chonchol Mahmud
  • 2,717
  • 7
  • 39
  • 72
0

Use _blank which opens the linked document in a new window or tab.

http://www.w3schools.com/tags/tag_a.asp

Lazar Nikolic
  • 4,261
  • 1
  • 22
  • 46