Now, let's see article of jquery onclick open url in new tab. if you have question about open url in new tab on button click jquery then i will give simple example with solution. i would like to show you onclick open link in new tab jquery. if you want to see example of jquery open link in new tab on click then you are a right place. Let's get started with jquery open link in new tab on button click.
I created two way to open link in new tab in jquery. first one is a using window.open() and another is 'target="_blank"' on anchor tag. so i added both example bellow you have to just check that you can see how it will helps us.
Let's see both example and you can use anyone as you need.
Example 1:
<!DOCTYPE html>
<html>
<head>
<title>Jquery Open Link in New Tab on Click Example - ItSolutionStuff.com</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<button class="btn">Click Me</button>
<script type="text/javascript">
$(".btn").click(function(){
window.open("https://www.itsolutionstuff.com");
})
</script>
</body>
</html>
Example 1:
<!DOCTYPE html>
<html>
<head>
<title>Jquery Open Link in New Tab on Click Example - ItSolutionStuff.com</title>
</head>
<body>
<a href="https://www.itsolutionstuff.com" rel="noopener noreferrer" target="_blank">Click Me</a>
</body>
</html>
I hope it can help you...
Do you like below Tutorials ?
- PHP Laravel 5.5 - import export data into excel and csv using maatwebsite
- Laravel 7.x and 6.x create custom facade example from scratch
- Node JS - Get Real time online users counter using socket io example
- PHP Laravel 7.x and 6.x - Bootstrap Admin Theme Integration example from scratch
- MySQL Query - How to select records of today to next Sunday ?
- Laravel 7.x and 6.x - username custom validation example
- Laravel 5.5 - Import Extract zip file using chumper/zipper package
- PHP Laravel Set Custom Validation Error Messages Example