Home >Web Front-end >JS Tutorial >How to jump to the page in jquery

How to jump to the page in jquery

王林
王林Original
2020-11-19 09:18:3010209browse

Jquery method to jump to the page: Jump by using the attribute replacement method attr() or prop(), such as [$(location).attr('href', 'url address')], 【$(location).prop('href', 'url')】.

How to jump to the page in jquery

The operating environment of this tutorial: Windows 7 system, jquery version 3.3.1. This method is suitable for all brands of computers.

There are several ways to jump to a page using jquery:

(Learning video sharing: jquery video tutorial)

1. Use http redirection to jump

window.location.replace("http://www.php.cn");

2. Use href to jump

window.location.href = "http://www.php.cn";

3. Use jQuery’s attribute replacement method to jump

$(location).attr('href', 'http://www.php.cn');
$(window).attr('location','http://www.php.cn');
$(location).prop('href', 'http://www.php.cn')

Related recommendations: js tutorial

The above is the detailed content of How to jump to the page in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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