Opening a URL in new tab using JavaScript, below snippet will do the trick
function OpenInNewTabWinBrowser(url) { var win = window.open(url, '_blank'); win.focus(); }
You could do it this way calling a direct function, or by adding an event listener to your DOM object.
Note: JavaScript, abbreviated as JS, is a high-level, interpreted programming language. It suits for development of client side behavior. Is JavaScript is easy to learn?. Yes, you can start with JavaScript basic programs in W3school website. There are many online courses to learn javascript in learning websites like Udemy.
nice work
Good work, if someone stumbles upon this and want to open link in new tab using html, check
How to open link (a href) in new tab instead of loading url on same page?
Wow! this is working for me!