+ 1
How do you make an onclick open in a new tab
say for instance i have the following code: <button onclick="location.href='www.google.com'" target="_blank">Go to Google </button>
3 odpowiedzi
+ 3
_blank makes it open in a new tab so i really dont get your question
+ 1
not with a button and a onclick="location.href='random website'" it will open in the same tag
+ 1
A couple of suggestions...
1. If you're good at CSS, replace <button> with <a> and style <a> to look like a <button>.
2. Use a hidden <a> and trigger its click event handler, when <button> is clicked. Example: https://jsfiddle.net/L6z5t84o/