The jquery method to jump to a page: first introduce the jquery file into the page; then create a button to trigger the jump; then add a click event for the jump button; finally operate the location object through jquery, and Call the attr method and assign the href attribute to the new url address.
Operating environment:Acer S40-51, Windows10 Home Chinese version, jquery1.8.3&&HBuilderX.3.0.5
Recommendation: "jquery video Tutorial》
jquery jump page
First, you need to introduce the script library file into the page.
Then create an html sample file test, and create a button to trigger the jump. Note that the current page is called 'Page A'. Then write JS script logic to add a click event for the jump button. We know that in native js, we use the location attribute in the window object to handle jumps. window.location.href = "abc.html"
Manipulate the location object through jquery and call attr Method, just assign the href attribute to the new url address.
test complete code:
Run the page and click the ‘Jump’ button above.
(Note that you are now in page A)
After clicking, you will successfully jump to the new page, (testb)
testb code such as:
For more computer programming related knowledge, please visit:Programming Teaching! !
The above is the detailed content of How to jump to the page with jquery. For more information, please follow other related articles on the PHP Chinese website!