I have a simple HTML/javascript question. I have a button and a link. My HTML looks like this :
<a id="a1" href="https://www.facebook.com/"> </a>
<input type="button">
How can I open the link by clicking the button? I know I can just type a function in javascript like
function f1() {
location = document.getElementById("a1").href;
}
and put it in the onclick attribute of the button but I want the link to be opened in a new tab. Can anyone tell me how to do this via javaScript/HTML?