jquery Mobile page After the jump, you must re-refresh the page JS in order to effectively

Source: Internet
Author: User

Recently in a project, using jquery Mobile, very unfamiliar to him, the problem of one after another, it is necessary to solve, find a day this problem, put can understand:
First understand JQM inside page jump by default is through the AJAX request, must re-refresh the page JS square can be effective, that is, JS does not work, not JS itself problem, the following talk about the solution:

when using JQuery Mobile for Web development, when the page jumps (PageA = PageB), the JS referenced in PageB does not run successfully. Because, JQM and loading the entire page into the current DOM, only the data-role= "page" element is added to the current DOM.
Therefore, the introduction of the external JS file in New Page The rear can be loaded successfully.

Given that the JQM feature is unlikely to be actively changed, There are two ways to solve :
first, in the index page, register all the required to the external JS file, or use the master page to unify;
Second, the page internal JS written in the data-role= "page" tag, so no matter how the page jumps, can be run.

How, solve it,!! @

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.