Raju.allen Raju.allen - 16 days ago 6
HTML Question

how to give a href inside the button tag in html

i need to open two links when a button is clicked in the html page. I figured it as by calling onclick function and creating anchor tag using createElement in Javascript. But how to include another link?? Is there a way to give a href in button tag??

Answer

You can simply do that with javascript

window.open(url1);
window.open(url2);

And if you want to open one of that links in curren window you can replace window.open by this

window.location = url1;
Comments