Home >Web Front-end >JS Tutorial >jquery simply implements the method of opening external links in a new window_jquery
The example in this article describes how to use jquery to open external links in a new window. Share it with everyone for your reference. The specific implementation method is as follows:
$("a[href^='http://']").click(function(){ this.target = "_blank"; });
Or use the following
$(function(){ $("a[href^='http://']").attr({'target':'_blank'}) })
I hope this article will be helpful to everyone’s jQuery programming.