I am using this function to take a person to a page by clicking a button
function newtoJs() {
window.location=("page/page2/www/index.html");
}
However, I want to open in a new window. How do I do that? These don’t work:
window.location=("page/page2/www/index.html" "target='_blank'");
window.location=("'page/page2/www/index.html' target='_blank'");
Here's a code snippet based on clicking a button to create the interaction.
<a class="clickme">Example Button</a>
<script type="text/javascript">
const el = document.querySelector('.clickme');
el.addEventListener('click', function() {
window.open('https://example.com', '_blank');
});
</script>