I've found some ways that should work in this forum, but it won't work for me. I to press on a link and then a new window should open in a new window.
My HTML-code is:
<!DOCTYPE html> <html lang="sv-se"> <head> <meta charset="UTF-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="Navigering.js"></script> <title>Navigering</title> </head> <html> <body> <h1>Navigering</h1> <a href="https://www.google.se/" alt="google">Link toGoogle</a> </body> And my JQuery-code:
$(document).ready(function(){ function myFunction() { $("a").attr('target','_blank'); } $(window).load(myFunction); }
html?Navigering.jscould return 404. 2- The code has a syntax error as posted in question. 3- You don't need window load inside DOM ready