0

I have both href and onclick events on my function.

On onclick i have code to naviage to perticuar page. When i click on open in new tab it opens a link wiht about:blank.

Can you help me what can i dot for this.

Below is my code.

<a href="javascript:void(0);" id="help" onclick="javascript:GoToURL('/html/mystats.cfm')" >Test </a>
Pritesh
  • 1
  • 3
  • Possible duplicate of [Open a URL in a new tab (and not a new window) using JavaScript](https://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window-using-javascript) – caramba Nov 18 '17 at 08:42
  • 1
    Why not just set the `href` to the url and use the `target` attribute if you want to open it in a new tab `target="_blank"`? I don't see the point of using `javascript` and writing a function to do something that anchor tags are designed to do/deal with. – NewToJS Nov 18 '17 at 08:44

1 Answers1

0

<a href="javascript:void(0);" onclick="window.open('https://www.example.com', '_blank'); ">Test</a>
vicky patel
  • 699
  • 2
  • 8
  • 14