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

  • SEARCH
  • Home
  • 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 8104797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:58:52+00:00 2026-06-05T23:58:52+00:00

Hi all I seem to be having a problem with my jQuery mobile script.

  • 0

Hi all I seem to be having a problem with my jQuery mobile script.

<script>
$(document).bind('pageinit', function()
    {
        var count=0;
        var pages = ["#home","#rich","#dan"];
        $('.master').click(function() 
        {
        count=count+1;

            $.mobile.changePage($(pages[count]));

            console.log(count);         

        });

    });
</script>

So what will happen is on first click it works. Count goes up to 1 and the page changes to #rich. Second click the count goes to 2 the page flashes real quick to #dan and then flashes right back to #rich and the count goes back down to 1. If i click again i get an error saying

b.data(“page”) is undefined

No idea why. Any help?

  • 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-05T23:58:53+00:00Added an answer on June 5, 2026 at 11:58 pm

    As Huangism suggested, pageinit is run every time a new page is loaded, most likely resetting your counter. Try setting up your click event using $(document).ready() or some other event that only fires once.

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

Sidebar

Related Questions

I am having a problem with GameQuery (jQuery) collision detection Tthey just never seem
I'm having a very weird problem with radio buttons in JQuery Mobile. I'm populating
all I'm new to jQuery and I'm having a bit of a problem manipulating
I seem to be having some problems creating a jquery plugin. I am testing
I seem to be having a problem when using Linq to Sql in which
Im having a problem and cant seem to find it for the life of
Greetings all, I'm an AJAX newbie, and I'm having a problem with same origin
Seem to be having a problem here. Been working off my netbook for a
Hello I seem to be having some problem involving counting in Django. I have
I seem to be having a problem with the following file: *User Type 0:

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.