saikat mukherjee saikat mukherjee - 4 months ago 9
Javascript Question

<button formtarget="_blank"></button> not working

I have a button tag that is referring to a link given as below

<button onclick="window.location='example.com'" formtarget="_blank"></button>


but its opening in the same tab what's the problem

Answer

formtarget only work for form, if you want for link, You can try this

<button onclick="window.open('https://www.google.com', '_blank');">BUTTON TEST</button>

JsFiddle