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 8992813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:02:45+00:00 2026-06-15T23:02:45+00:00

what I am trying to do is load a function in an anchor to

  • 0

what I am trying to do is load a function in an anchor to change the page in jquery mobile

Here is the simplified HTML:

<div data-role="page" id="oldPage">
    <ul>
       <li><a href="newPage()">Link 1</a></li>
       <li><a href="newPage()">Link 2</a></li>
       <li><a href="newPage()">Link 3</a></li>
    </ul>
</div>
<div data-role="page" id="newpage">
</div>

Here is the script:

     function newPage() {
       $.mobile.changePage('#newpage');
     }

But when I click the link I get the message “Error Loading page”. How can I load a function to change to this new page, by clicking the link?

  • 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-15T23:02:46+00:00Added an answer on June 15, 2026 at 11:02 pm

    It would be href="javascript:newPage()" but I do not recommend it

    instead consider

    <div data-role="page" id="oldPage">
        <ul>
           <li><a href="#page1" id="someId1">Link 1</a></li>
           <li><a href="#page2" id="someId2">Link 2</a></li>
           <li><a href="#page3" id="someId3">Link 3</a></li>
        </ul>
    </div>
    <div data-role="page" id="newpage">
    </div>
    
    $(function() {
      $("#oldPage a").on("click",function() { 
        $.mobile.changePage($(this).attr("href"));
     });
    });
    

    I am guessing you mean

    $(function() {
      $("#oldPage a").on("click",function() { 
        $("#oldPage").load($(this).attr("href"));
     });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to load from initial.html different html page with: $(#hidden_demo_div).load(modules/another.html, function (data) {
I'm trying to load some external content using jQuery load function to div on
I am trying to load HTML via JQuery, using the .load function. This is
I am trying to load a part of the page using jQuery load function
I am trying to load an external jquery page into a div. I use
I'm trying to load a page using the load() function, the problem is that
I'm trying to load a .json file with this line: $.getJSON('engines.json',{},function(data){ alert(data); }); If
I'm trying to use the .each() function of JQuery on a body load to
so I am trying to load in content with ajax jQuery and here is
I am trying to load images through ajax call in jquery using This here

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.