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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:25:24+00:00 2026-06-12T05:25:24+00:00

I am trying to create and android app using jquerymobile and cordova 2.0.0. I

  • 0

I am trying to create and android app using jquerymobile and cordova 2.0.0. I am planning to add localStorage which will save settings of app to android storage. Right now I am trying to force my jquerymobile select menus to show the currently saved value.

Example:
Imagine that you have a menu (settings) consisting of 3 items (disabled, enable, compatibility mode) and you chose compatibility mode and save settings. Then variable settings is stored and set to compatibility. But when you load the settings next time it will looks like menu (settings) is set to disabled because it is the first option in list. So I want my program to display currently selected and saved option in settings. I have tried it by using body onload calling load() function which would set selectedIndex from stored value but it didnt worked (maybe my bad code).

So I need my javascript to construct select menu and change the order of options but it is not working.

Here is my HTML code:

<div data-role="content" data-theme="c" id="content">
        <div data-role="fieldcontain" onLoad="load();">
            <label for="transitions" class="select">Prechody:</label>
                <select name="transitions" id="transitions">

                </select>
        </div>      
        <div data-role="fieldcontain">
            <label for="entriesNumber">Počet zobrazovaných príspevkov:</label>
            <input type="range" name="entriesNumber" id="entriesNumber" value="25" min="0" max="35"  />
        </div>
</div>

and here is javascript:

function load(){
var select = document.getElementById("transitions");
var option1 = document.createElement("option");
option1.setAttribute("value","vypnute");
option1.innerHTML("Vypnúť");
select.appendChild(option1);
var option2 = document.createElement("option");
option2.setAttribute("value","zapnute");
option2.innerHTML("Zapnúť");
select.appendChild(option2);
var option3 = document.createElement("option");
option3.setAttribute("value","kompatibilita");
option3.innerHTML("Zapnúť v režime kompatibility");
select.appendChild(option3);
}

If you know how to do this by using selectedIndex (http://www.w3schools.com/jsref/prop_select_selectedindex.asp) or by any other more clear way please post it here. If not then please try to check my JS code so it would work.

  • 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-12T05:25:26+00:00Added an answer on June 12, 2026 at 5:25 am

    I figured it out. Just needed to use this code:

    document.getElementById("selection").selectedIndex = 2/*selected value*/; 
    $("#selection").selectmenu('refresh');
    

    Also if you are using jquerymobile slider (range) than you can use this code to update its value:

    $('#slider').val(updatedValue).slider('refresh');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create an android app which will show multiple web urls
Hi im trying to create a simple android app using the Eclipse IDE, all
I am trying to create an android app that will connect to various web
i am trying to create a simple android app using eclipse and android sdk
I'm trying to create an Android app in Java (using Ubuntu 11.10 with the
I'm trying to create a program for Android which will read in text, and
I am trying to create an Android app using Maven as describe in this
I'm trying to create an app using phonegap and localStorage, it works well on
I am trying to create an app on android which makes users login in
I'm trying to create an Android (2.2) app using Phonegap (version 1.9.0) and jQuery

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.