-4
I need to do, in javascript, a link that opens a page in a new tab and redirects the current page to another link.
-4
I need to do, in javascript, a link that opens a page in a new tab and redirects the current page to another link.
1
HTML:
<a href="https://www.google.com" target="_blank" id="xx">abrir em nova janela</a>
JS:
document.getElementById('xx').addEventListener('click', function(){
location.replace('https://answall.com');
});
Browser other questions tagged javascript link url-forwarding
You are not signed in. Login or sign up in order to post.
Sorry to ask ,I am completely layman, what is xx ?
– toredo
xx is the name of id. Ids are a way to identify an element, and should be UNIQUE for each element.
– user60252