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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:41:40+00:00 2026-05-23T23:41:40+00:00

I have a problem with dropdown… I hav a drop down on a page

  • 0

I have a problem with dropdown… I hav a drop down on a page and a button save.. When you choose an option of drop down you want.. and click save.. the value goes to DB and stored there.. when you go on this page again… the drop down must show the value you saved previous time… but i have a problem.. when i come to this page.. dropdown don’t show me the correct value.. it shows me the first value.. but when i click on it the option that selected in this menu is right..

I think maybe i need to refresh it or something?

here is js->

    <script>
    $(document).ready(function() {
        var defaultValue = Settings.getDefaultTimespan();


        if (defaultValue == $('#opt' + defaultValue).val()) {

            $('#opt' + defaultValue).attr('selected','selected');  
        }

        $('#saveBtn').click(function() {

            Settings.setDefaultTimespan(parseInt($('#timeSettingsDropList').val()));

        });
    });
    </script>

Here is HTML->>

            <div id="timespanSettings">
                <table>
                    <tr>
                        <td style="width: 15%"><p>Default timespan:</p></td>
                        <td style="width: 85%"><select name="timeDropList" id="timeSettingsDropList">
                                <option id="opt0" value="0">6 Minutes</option>
                                <option id="opt1" value="1">10 Minutes</option>
                                <option id="opt2" value="2">15 Minutes</option>
                                <option id="opt3" value="3">30 Minutes</option>
                                <option id="opt4" value="4">1 Hour</option>
                        </select></td>
                    </tr>
                </table>

            </div>

As you can see.. dropdown shows “6 Minutes” but selcted is “1 Hour”

enter image description here

  • 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-23T23:41:41+00:00Added an answer on May 23, 2026 at 11:41 pm

    Not sure if this will work but what about using localStorage? Live Example:

    • http://jsfiddle.net/phillpafford/trdYP/19/

    JS:

    var ts = localStorage.getItem('timeSelected');
    
    var tsList = $('#timeSettingsDropList');
    tsList[0].selectedIndex = ts;
    tsList.selectmenu("refresh");
    
    $('#timeSettingsDropList').change(function() {
        localStorage.setItem('timeSelected', $(this).val());
        ts = localStorage.getItem('timeSelected');
    });
    

    HTML:

    <div data-role="page" id="home"> 
        <div data-role="content">
            <div id="timespanSettings">
                <table>
                    <tr>
                        <td style="width: 15%"><p>Default timespan:</p></td>
                        <td style="width: 85%"><select name="timeDropList" id="timeSettingsDropList">
                                <option id="opt0" value="0">6 Minutes</option>
                                <option id="opt1" value="1">10 Minutes</option>
                                <option id="opt2" value="2">15 Minutes</option>
                                <option id="opt3" value="3">30 Minutes</option>
                                <option id="opt4" value="4">1 Hour</option>
                        </select></td>
                    </tr>
                </table>
            </div>
            <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f"> 
                <li data-role="list-divider">Navigation</li> 
                <li><a href="#page2">View Page 2</a></li> 
            </ul> 
        </div>
    </div>
    <!-- Page 2 -->
    <div data-role="page" id="page2"> 
        <div data-role="content">
            <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f"> 
                <li data-role="list-divider">Navigation</li> 
                <li><a href="#home">View Home Page</a></li> 
            </ul>
        </div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've run on a little problem today: I have a JS drop down menu
I have a problem with Firefox I have a drop down menu at the
I have problem with return statment >.< I want to store all magazine names
I'm using entity framework and i have a problem that this dropdown ignores my
I have a problem in C#, Help me please in: I have a dropdown
EDIT: The drop down menus have the following listed in them: Typing Course Daily
I have a cascading dropdown list on my page. The first dropdown contains a
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE

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.