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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:39:40+00:00 2026-05-26T17:39:40+00:00

I am relatively new to jquery and jquery mobile. I have a new mobile

  • 0

I am relatively new to jquery and jquery mobile. I have a new mobile site that uses the ajax loading of pages. The problem of course is that it will not load the script on each page so the script has to go onto the home page with the menu.

I use the pagecreate to listen for the page and then load the script for it.

The problem I am having is that on one page I have a submit button which calls a function. The pagecreate does its job and loads the script but when I click the submit button the function does not get called. The function is ok on it’s own, so the problem must be that you cant just put a function into the pagecreate.

I am not sure what is the correct syntax.

        $('#calendar').live('pagecreate',function(event){
            function makeUpDates(){
                // concantenate values to date_start and date_end hidden inputs
                var dateString = document.getElementById('date').value,
                date = new Date(dateString);

                document.getElementById('date_start').value = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();

                var numDays = document.getElementById('slider').value;
                date.setDate(date.getDate() + parseInt(numDays));   

                var dateEnd = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
                document.getElementById('date_end').value = dateEnd;

            }
        });         
  • 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-26T17:39:40+00:00Added an answer on May 26, 2026 at 5:39 pm

    UPDATE:

    Would this work

    HTML (page with id=’calendar’), removed onclick and added id

    <button type="submit" name="continue" id="continue" data-icon="arrow-r" data-iconpos="right">Continue</button>
    

    JS

    $('#calendar').live('pagecreate',function(event){
        // Call function when live event happens         
        $('#continue').click(function() {
            makeUpDates();
        });
    });
    
    // Move function outside live event
    function makeUpDates() {
        // concantenate values to date_start and date_end hidden inputs
        var dateString = document.getElementById('date').value,
        date = new Date(dateString);
    
        document.getElementById('date_start').value = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
    
        var numDays = document.getElementById('slider').value;
        date.setDate(date.getDate() + parseInt(numDays));   
    
        var dateEnd = date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
        document.getElementById('date_end').value = dateEnd;
    }
    

    I’m not sure you even need the live event, you could try this as well

    //$('#calendar').live('pagecreate',function(event){
        // Call function when live event happens         
        $('#continue').click(function() {
            makeUpDates();
        });
    //});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am relatively new to using jQuery and I have a problem with creating
I'm relatively new to jquery, so I have what I hope will be a
I am relatively new to jQuery Mobile. So, I do not know every corner
Relatively new to JQuery. I've got some code that does a banner swap with
I'm relatively new to jquery/ajax, and I'm having trouble parsing the results from a
I've posted similar question but no response. I have a jQuery Mobile site and
I have a simple horizontal menu that uses JQuery to vertically slide down a
Being relatively new to javascript, AJAX and jQuery, I want to post 3 values
I'm relatively new to jQuery/Ajax and I was wondering what would be the best
I am relatively new to implementing JQuery throughout an entire system, and I am

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.