Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7748229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:43:45+00:00 2026-06-01T10:43:45+00:00

js doesn’t work if I don’t refresh the page after first load,and div’s background-img

  • 0

js doesn’t work if I don’t refresh the page after first load,and div’s background-img also doesn’t show.
code:<a data-role="button" data-icon="plue" href="register.jsp" data-transition="pop">register</a>
js and css can be successfully loaded if I set data-ajax=’false’,but I want to have a transition

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:43:46+00:00Added an answer on June 1, 2026 at 10:43 am

    jQM doesn’t load a full page when AJAX is turned on, it fetches the page and then strips out anything in the head tag. Their logic is that this stuff will stay consistent throughout your application so for the sake of fewer downloads and faster load time, remove it, parse the HTML and inject it as a new page (which is why you also get the hashtag navigation).

    jQM will also not run any JS that is within a page if AJAX is running. So if you’re doing something like onClick="SomeJS();" this will not run. Which you shouldn’t be doing anyway with jQuery in general.

    To get around that and to prevent JS errors for elements that aren’t on every page, I’ve started doing something like this:

    Just after your body tag, put a wrapper DIV or Section (since any smart phone reads HTML5 pretty well) with an id or distinct class and add the data-role=”page” attribute.

    <body>
    <div id="page1" data-role="page">
    ... page content ...
    </div>
    </body>
    

    Keep all of your JS in one file or reference all of your files on every page. When you have a page specific script that needs to run, wrap it in something like this:

    $('#page1').live('pageshow', function() {
    //do what you need to do
    });
    

    Hopefully that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why doesn't this work? HTML <div class=gallery> <div class=viewport> <div class=wrapper> <img src=img/boat1.png />
Why doesn't Html.ActionLink work in the below code? This is a page in the
Why doesn't this work? var newbody = <body><div>hello</div></body>; $(body).remove(); $(head).after(newbody); All i get after
Why doesn't this code work? I'am using FF. <head> <script type=text/javascript> document.getElementById(someID).onclick = function(){
Why doesn't the file input element show up at all??? see code and screen
Why doesn't this jQuery code work? $(document).ready(function () { $('currentPage').click(function() { $('myaccount').slideDown('slow', function() {
Why doesn't UITableViewCell background color work (set in interface builder)? I note from some
Why doesn't the following code work? $('select option').live('click', function(){ alert('hello') }) html: <select class=ok>
doesn't work.. can't find any solution to prevent submit page reload only if ajax
Doesn't seem to work for me, maybe I just doing it wrong

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.