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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:22:28+00:00 2026-06-04T18:22:28+00:00

I use VS2010 to write a phonegap small example but I dont know why

  • 0

I use VS2010 to write a phonegap small example but I dont know why I can not use window.locaStorage to store and retrieve simple value

Please check and let me know what is wrong

    <!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>

    <title>Cordova WP7</title>

      <link rel="stylesheet" href="jquery.mobile-1.1.0.css" type="text/css"/>
      <script src="jquery-1.7.2.js" type="text/javascript"></script>

      <script src="jquery.mobile-1.1.0.js" type="text/javascript"></script>


      <script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>

      <script type="text/javascript">


        document.addEventListener("deviceready",onDeviceReady,false);

        // once the device ready event fires, you can safely do your thing! -jm
        function onDeviceReady()
        {
            //document.getElementById("welcomeMsg").innerHTML += "Cordova is ready! version=" + window.device.cordova;
            console.log("onDeviceReady. You should see this message in Visual Studio's output window.");
            //navigator.notification.alert("Hello World");

        };

        $(function(){

          $("#savebtn").click(function(){
            window.localStorage.setItem("modelname", $("#modelname").val());

          });

        $("#androidpg").live("pageshow", function () {
            var moname = ""
            moname = window.localStorage.getItem("modelname");

          if (moname.length > 0) {
              $("#modelname").val(moname);
          }

        });

      });

      </script>

  </head>
  <body>
    <div data-role="page" id="home">

      <div data-role="header">
        <h1>Home</h1>

      </div>
      <div data-role="content">
        This Demo can run on:
        <ul>
          <li>iOS</li>
          <li>Android</li>
          <li>BlackBerry</li>
          <li>Windows Mobile</li>
        </ul>
        <a href="#androidpg" data-role="button">Goto Android Page</a>

      </div>

      <div data-role="footer" data-position="fixed">
        <h4>All Rights Reserved</h4>

      </div>   

    </div>

    <div data-role="page" id="androidpg">

      <div data-role="header">
        <h1>Android</h1>

      </div>
      <div data-role="content">
        <h1>Android Page</h1>

        <label for="modelname">Enter Model Name:</label>
        <input type="text" name="modelname" id="modelname" value="" />
        <a href="#savebtn" data-role="button">Save</a>

      </div>

      <div data-role="footer" data-position="fixed">
        <h4>All Rights Reserved</h4>

      </div>   

    </div>

  </body>
</html>

Thanks

  • 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-04T18:22:31+00:00Added an answer on June 4, 2026 at 6:22 pm

    The id-selector #savebtn looks for an element with an id of savebtn. Your link <a href="#savebtn" data-role="button">Save</a> doesn’t have an id of savebtn (no element does in the code you posted). Add an id to your anchor. <a href="#savebtn" id="savebtn" data-role="button">Save</a>

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

Sidebar

Related Questions

Hi Anybody knows how can I use VS2010 IDE to write my own language
Can you use Ninject 2.0 with VS2010 RC1?
Does anyone know if VS2010 will use the same project & solution file format
When I use VS2010 SP1, I write a windows service. Now I want to
I use VS2010, C# to develop Silverlight 4 app, I use following code in
I use VS2010, C#, ASP.NET; I read some data from SQL server and fill
I use VS2010, C# to develop ASP.NET web app, I create some sessions in
Is there a way to use the SQL Model (dbml) builder in VS2010 using
I'm using VS2010,C# to develop a Silverlight online game, I use keyboard for getting
I've been using VS2010 and I want to use some type of source control.

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.