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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:26:43+00:00 2026-05-28T16:26:43+00:00

I am trying to change page on a form submit in Jquery, however, it

  • 0

I am trying to change page on a form submit in Jquery, however, it is not working. It slides to show the same page instead of navigating to the target page. Below is the code. Any insights please? I tried using "#mainpage" , "index.html#mainpage" as well and still the same result. Link: jsfiddle.net/7yRph/1

<!DOCTYPE html> 
<html> 
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>Multi-page template</title> 
    <link rel="stylesheet" href="jquery.mobile-1.0.min.css" />
    <script src="jquery-1.6.4.min.js"></script>
    <script src="jquery.mobile-1.0.min.js"></script>
    <script type="text/javascript">
    $('#launchpage').live('pagecreate',function(event) { 
        $('#fhome').submit( function () {
            $.mobile.changePage("mainpage");
        });
    });
    </script>
</head> 
<body> 

<!-- PAGE: launchpage -->
<div data-role="page" id="launchpage">
    <div data-role="header">
        <h1 data-theme="g" >Personal Details</h1>
    </div><!-- /header -->

    <div data-role="content" >  
        <div class="content-primary">
        <form id="fhome" method="POST" >
            <div data-role="none">
                <p> Lets begin: </p>
            </div>
            <br/>           
            <div data-role="fieldcontain">
                <fieldset data-role="controlgroup" data-type="horizontal" >
                    <legend>Are you providing information about yourself?</legend>
                        <label for="launchradioyes">Yes</label>
                        <input type="radio" name="radio-choice" id="launchradioyes" value="yes" />
                        <label for="launchradiono">No</label>
                        <input type="radio" name="radio-choice" id="launchradiono" value="no" />
                </fieldset>
            </div>
            <input type="submit" value="Next" data-theme="a" />
            <br/>
         </form>
    </div><!-- /content -->

    <div data-role="footer" data-theme="d">

    </div><!-- /footer -->
</div><!-- /launch page -->

<!-- PAGE: mainpage -->
<div data-role="page" id="mainpage">
    <div data-role="header">
        <h1>Testing page navigation II</h1>
    </div><!-- /header -->

    <div data-role="content" >  
        <div class="content-primary">
            <div data-role="none">
             <label for="idprimary">ID:</label>
             <input type="tel" name="idprimary" id="idprimary" value="" />
            </div>
            <br/>           
    </div><!-- /content -->

    <div data-role="footer" data-theme="d">
    </div><!-- /footer -->
</div><!-- /page one -->

</body>
</html>
  • 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-05-28T16:26:44+00:00Added an answer on May 28, 2026 at 4:26 pm

    You are missing your action attribute in your form tag. This often breaks functionality of forms in browsers. Try this:

    <form id="fhome" method="POST" action="mainpage">
    

    It shouldn’t negatively affect your code as you hijack the submit action anyway.

    UPDATE

    Also, you are missing your closing </form> tag and another closing </div> tag after that.

    Do you need to use a submit button? Would it work to use a button and its corresponding click event?

    http://jsfiddle.net/shanabus/7yRph/3/

    UPDATE 2, working with form submit

    After you resolve the closing tags, add the preventDefault method call and the data-ajax="false" attribute as outlined here in the docs.

    example: http://jsfiddle.net/shanabus/7yRph/9/

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

Sidebar

Related Questions

I have a form that i am trying to submit after the page loads
I am trying to submit a form using jQuery's .ajax() function. It seems like
I'm trying to use the jQuery forms plugin to dynamically submit a form on
I'm writing some Javascript code and I'm trying to change the current page as
I'm trying to figure out how to change an embedded web page when the
I'm trying to change user input in wildcard form (*word*) to a regular expression
I am trying to update mysql data by letting users submit a form. The
I'm trying to create a single page form to create a 'work item'. One
I have a form on an HTML page with multiple submit buttons that perform
I am trying to change a page in the Wordpress menu dynamically. That is,

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.