title: jQuery Mobile Change DropDown Selected Option and refresh it
body: <p>I am writing jQuery Mobile App.
  I am changing drop-down selected option via below statement:-
    $("#DataBaseNames").val(db);</p>
  
  <p>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. </p>
  
  <p>Any refresh call I need to insert?</p>
  
  <p>Edit:-Adding code, below answer from phill solved it</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;   
  
          $("#@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 &lt; 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;
          }
      &lt;/script&gt;
  </code></pre>