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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:27:01+00:00 2026-05-26T22:27:01+00:00

I am writing jQuery Mobile App. I am changing drop-down selected option via below

  • 0

I am writing jQuery Mobile App.
I am changing drop-down selected option via below statement:-
$(“#DataBaseNames”).val(db);

I am sure about correct db value being passed, as i checked it via alert.
When I drill down the drop down, it also shows the correct text selected, but dropdown itself is not showing the correct text as selected.

Any refresh call I need to insert?

Edit:-Adding code, below answer from phill solved it

<script type="text/javascript">   

        $("#@ViewBag.DivTitle").live('pageshow', function () {

            var db = getCookie("DataBaseNames");

            $("#DataBaseNames").val(db);            
            $("#DataBaseNames option[value='"+ db + "']").attr("selected", "selected");

            //      refresh value , Following is what is required        
            $('select').selectmenu('refresh');

            $("#cmdLogOn").live("click", function () {
                var dbSelected = $("#DataBaseNames option:selected").text();              
                setCookie('DataBaseNames', dbSelected);
            });
        });

        function setCookie(name, value) {
          var expires = "";
            document.cookie = name + "=" + value + expires + "; path=/";
        }

        function getCookie(name) {
            var nameEQ = name + "=";
            var ca = document.cookie.split(';');
            for (var i = 0; i < ca.length; i++) {
                var c = ca[i];
                while (c.charAt(0) == ' ') c = c.substring(1, c.length);
                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
            }
            return null;
        }
    </script>
  • 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-26T22:27:01+00:00Added an answer on May 26, 2026 at 10:27 pm

    refresh update the custom select

    This is used to update the custom select to reflect the native select element’s value.If the number of
    options in the select are different than the number of items in the
    custom menu, it’ll rebuild the custom menu. Also, if you pass a true
    argument you can force the rebuild to happen.

    //refresh value         
    $('select').selectmenu('refresh');
    
    //refresh and force rebuild
    $('select').selectmenu('refresh', true);
    

    Docs:

    • http://jquerymobile.com/demos/1.0rc3/docs/forms/selects/methods.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm diving into writing a mobile app with jQuery Mobile/PhoneGap. I'm using this sample
I am currently writing a small web app using Asp.net MVC and jQuery mobile.
I'm currently writing a mobile app (hopefully iOS or android) using the jquery mobile
I'm writing an iPhone app using jQuery mobile & phonegap. When I rotate my
I am writing mobile app with JQUery Mobile Beta 1 and was expecting that
I'm writing a mobile app with PhoneGap and jQuery Mobile. To simplify navigation I
I've been toying with writing a web app using jquery mobile which makes use
I am having a problem with an application I am writing in jquery mobile
I am writing a JQuery mobile application. In this application, I need to dynamically
I'm writing jQuery for an app that's being build in JSF. The JSF components

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.