javascript Open Link in New Tab on Click
Hi Guys,
In this blog, I will teach you how to oprn link in new tab using on click in javascript. Open url in new tab then you can use this example.
You will see example of onclick open link in new tab in javascipt. I am use window.open() to open link in new tab using javascript.
Let's see example and you can use anyone as you need.
Example
<!DOCTYPE html>
<html>
<head>
<title>javascript open link in new tab on click - nicesnippets.com</title>
</head>
<body>
<h1>NiceSnippets.com</h1>
<button onclick="getLink();">Click me</button>
<script type="text/javascript">
function getLink() {
window.open("/");
}
</script>
</body>
</html>
It will help you...
- How to set Date in setUTCHours() Method in JavaScript?
- How to Date sets UTC milliseconds in Javascript?
- How to Use push(), unshift(),pop() and shift() With Array in Javascript?
- How to Check if a Variable is a Number in Javascript?
- How To Format a Number Using Fixed - Point Notation in Javascript?
- How to Insert an Element into an Array in javaScript?
- How to remove duplicate elements from JavaScript Array?
- How to calculate years, months and days between two dates in javascript?