Home Web Front-end JS Tutorial How to use jquery settings to open external links in a new window

How to use jquery settings to open external links in a new window

Apr 26, 2018 pm 05:49 PM
jquery Open window

This time I will show you how to use jquery to set up external links to open in a new window, and how to use jquery to set up external links to open in a new window. What are the precautions? Here is the actual combat Let’s take a look at the case.

$("a[href^='http://']").click(function(){
 this.target = "_blank";
});
Copy after login

Or use the following

$(function(){
 $("a[href^='http://']").attr({'target':'_blank'})
})
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

jQuery tab switching special effects implementation steps

How jquery operates dynamic switching between images and animations

The above is the detailed content of How to use jquery settings to open external links in a new window. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to set Google Chrome to open a new window every time How to set Google Chrome to open a new window every time Mar 06, 2024 pm 06:19 PM

How to set Google Chrome to open a new window every time? Vicious users like to use Google Chrome for work or study. This browser is safe, fast, and convenient. Different users have different preferences for using browsers. Some users like to open Google Chrome as a new window to facilitate quick searches. , so how to set it up. Next, the editor will bring you a tutorial on setting up a new window every time you open Google Chrome. Friends who are interested can come and learn it. Tutorial on setting up a new window every time Google Chrome opens 1. Double-click Google Chrome on your computer desktop to open it, then click on the [three dots] icon in the upper right corner. 2. Find the [Settings] option and enter the page (as shown in the picture). 3. Go to Google Chrome

Where can I open the Douyin mini game? Two ways to open Douyin mini games Where can I open the Douyin mini game? Two ways to open Douyin mini games Mar 15, 2024 am 09:30 AM

Douyin is a popular short video social application. Users can not only watch and share various types of short video content, but also provide a series of mini games for you to play. So where can I get into Douyin mini-games? Where is the entrance to Douyin mini game? Let’s take a look at the detailed tutorial below. Method 1: Open the mini program 1. Click the My option. After entering the homepage of Douyin, click the My option to enter. 2. Click the three horizontal lines. After entering the My interface, click the three horizontal lines button above. 3. Click on the mini program. After opening the three horizontal lines option, click on the mini program inside. 4. Click on the Douyin Mini Game. After entering the mini program interface, click on the Douyin Mini Game option to open it. Method 2: Search and open 1. Click the magnifying glass to enter

How to use PUT request method in jQuery? How to use PUT request method in jQuery? Feb 28, 2024 pm 03:12 PM

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

jQuery Tips: Quickly modify the text of all a tags on the page jQuery Tips: Quickly modify the text of all a tags on the page Feb 28, 2024 pm 09:06 PM

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: &lt

Use jQuery to modify the text content of all a tags Use jQuery to modify the text content of all a tags Feb 28, 2024 pm 05:42 PM

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on ​​the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

How to open Minesweeper? -How to mark small flags in Minesweeper? How to open Minesweeper? -How to mark small flags in Minesweeper? Mar 18, 2024 pm 10:46 PM

How to open Minesweeper? Minesweeper is a classic single-player game in which the player's goal is to uncover numbers within squares in order to determine which squares contain mines. If the revealed square contains no mines, the game will continue; if the revealed square contains mines, the game will end immediately. Next, we will introduce in detail how to enter the Minesweeper game. Step 1: Turn on the computer First, you need to turn on the computer. Minesweeper is a computer game that can only be played on a computer. If you haven't turned on the computer yet, press and hold the power button until the computer turns on and displays the desktop. Step 2: Find the Minesweeper game. Look for the Minesweeper game icon on the desktop. If Minesweeper is already installed, it should appear on the desktop. If not, search for Minesweeper game in your computer's start menu

How to open games on WeGame Tencent game platform - How to open games on WeGame Tencent game platform How to open games on WeGame Tencent game platform - How to open games on WeGame Tencent game platform Mar 04, 2024 pm 10:19 PM

WeGame Tencent game platform is a software that many gamers like to use. So do you know how to open games on WeGame Tencent game platform? Below, the editor will bring you how to open games on WeGame Tencent game platform. Let us take a look below. Take a look. Open the Tencent WeGame software and click the "Home" option above the software. Click the game on the left side of the page. If the game has not been downloaded, you need to download it first before you can open the game. Click on the downloaded game. Click "Start Game" to open the game.

How to tell if a jQuery element has a specific attribute? How to tell if a jQuery element has a specific attribute? Feb 29, 2024 am 09:03 AM

How to tell if a jQuery element has a specific attribute? When using jQuery to operate DOM elements, you often encounter situations where you need to determine whether an element has a specific attribute. In this case, we can easily implement this function with the help of the methods provided by jQuery. The following will introduce two commonly used methods to determine whether a jQuery element has specific attributes, and attach specific code examples. Method 1: Use the attr() method and typeof operator // to determine whether the element has a specific attribute

See all articles