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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:12:59+00:00 2026-05-26T23:12:59+00:00

I am following the example in the O’Reilly Building iPhone Apps with HTML, CSS

  • 0

I am following the example in the O’Reilly “Building iPhone Apps with HTML, CSS and Javascript,” I want the values entered from a form to populate after the app closes and reloads, similar to a php ‘sticky form.’

The only aspects I changed from the example is that saveSettings is called on submit, and here I have it called on unload (previously on input blur).

Load settings is called on document ready rather than submit.

pageInit is not working though I have jquery mobile installed.

     <!DOCTYPE html> 
        <html> 
        <head> 
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.css" />
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
        <script type="text/javascript" src="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js"></script>

        <script>
 $(document).ready(function(){
$(window).unload(saveSettings);
loadSettings();
});

function loadSettings() {
$('#monthly-income').val(localStorage.income);
$('#saving-per-month').val(localStorage.saving);
$('#current-age').val(localStorage.age);
}

function saveSettings() {
localStorage.age = $('#current-age').val();
localStorage.saving = $('#saving-per-month').val();
localStorage.income = $('#monthly-income').val();
}  
        </script>


        </head> 
        <body> 
        <div data-role="content">   
            <div data-type="horizontal"  data-role="controlgroup">
                <a href="#foo"   data-role="button">Input</a>
                <a href="#foo1"  id="output-button" data-role="button">Output</a>
            </div>
            <input type="number" min="500" max="10000" step="100" name="monthly-income" id="monthly-income" value=""/>
            <input type="number"  min="500" max="10000" step="100" name="saving-per-month" id="saving-per-month" value=""/>
            <input type="number" min="16" max="75" step="1" name="current-age" id="current-age" value=""/>
        </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-26T23:13:00+00:00Added an answer on May 26, 2026 at 11:13 pm

    1) You could place your page in internet, at best providing QR code to fast load on mobile (free QR generator here), so everyone could easily test

    2) Did the browser settings require to grant the domain the rights to store values in local storage? If so, onunload there’s no place to accept such request. Place in your ready function one storage instruction to test

    3) unload is a bit unreliable (example – browser crash). Have you considered saving values on onblur on inputs? When in large textareas, saving the value in timer, even if user is still editing, is practicised.

    4) This question considers also problems with unload function. Maybe future answer to this question will solve your problem?

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

Sidebar

Related Questions

Following example from this link: http://developer.kde.org/documentation/books/kde-2.0-development/ch03lev1sec3.html #include <QObject> #include <QPushButton> #include <iostream> using namespace
Example: Suppose in the following example I want to match strings that do not
In the following example should I expect that values.size() will be called every time
For the following example: http://developer.yahoo.com/yui/examples/tabview/frommarkup_clean.html I would like to make the tabs right aligned
The following example shows what I want to do: >>> test rec.array([(0, 0, 0),
The following example: http://www.raddonline.com/blogs/geek-journal/iphone-sdk-uitabbarcontroller-how-to-save-user-customized-tab-order/ Doesn't work in iOS4. I would like to be able
In the following example, how to inject a class from third-party library? For example
Consider the following example from APUE book: #include <errno.h> #include <sys/socket.h> int initserver(int type,
Following example code from the libpcap documentation yields the following code which should report
Following Example 2 in http://knockoutjs.com/documentation/hasfocus-binding.html JSFiddle showing problem: http://jsfiddle.net/hXqFu/2/ It works great for both

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.