title: jquery mobile - set select/option values
body: <p>am trying to set select/option values using jquery Mobile and can't seem to get it working.</p>
  
  <pre><code>&lt;!-- Complete example below. --&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;link rel="stylesheet" href="jquery.mobile/jquery.mobile.css" /&gt; 
      &lt;script type="text/javascript" src="jquery.mobile/jquery.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="jquery.mobile/jquery.mobile.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div data-role="page" id="mainmenu"&gt;
      &lt;div data-role="header" data-position="inline"&gt;
      &lt;h1&gt;Main Menu&lt;/h1&gt;
      &lt;/div&gt;
      &lt;div class="ui-body ui-body-c"&gt;
      &lt;div data-role="content"&gt;   
          &lt;div id='placeholderA' &gt;&lt;/div&gt;  
          &lt;div id='placeholderB' &gt;&lt;/div&gt;  
      &lt;div class="ui-block-b"&gt;&lt;button type="submit"  id="addPart" data-theme="a" data-icon="plus"&gt;Add Serial/Part&lt;/button&gt;&lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;         
  
  &lt;script&gt;        
  
      var currentTab = "A";       
  
      // An XML fragment
      testXML =  "&lt;?xml version='1.0' encoding='UTF-8' ?&gt;\
      &lt;Doc&gt;\
          &lt;DtlFields&gt;\
              &lt;ACTC&gt;B&lt;/ACTC&gt;\
              &lt;QTY&gt;5&lt;/QTY&gt;\
          &lt;/DtlFields&gt;\
          &lt;DtlFields&gt;\
              &lt;ACTC&gt;A&lt;/ACTC&gt;\
              &lt;QTY&gt;6&lt;/QTY&gt;\
          &lt;/DtlFields&gt;\
      &lt;/Doc&gt;";
  
      // An HTML fragment
      section = "&lt;ul data-role='listview' data-theme='a'&gt;\
              &lt;li&gt;PART: &lt;span class='thisSection'&gt;&lt;/span&gt;\
              &lt;div data-role='fieldcontain'&gt;\
                  &lt;label&gt;A Label&lt;/label&gt;\
                  &lt;select name='ACTC' id='preAction' data-theme='a'&gt;\
                  &lt;option value='A'&gt;A&lt;/option&gt;\
                  &lt;option value='B'&gt;B&lt;/option&gt;\
                  &lt;option value='C'&gt;C&lt;/option&gt;\
                  &lt;/select&gt;\
              &lt;/div&gt;\
              &lt;/li&gt;\
              &lt;/ul&gt;\
              &lt;!-- ***   Quantity     *** --&gt;\
              &lt;div data-role='fieldcontain'&gt;\
                  &lt;label&gt;QTY&lt;/label&gt;\
                  &lt;input type='range' name='QTY' id='preQuant01' value='1' min='1' max='10'/&gt;\
              &lt;/div&gt;\
          &lt;/div&gt;";
  
  
  $(document).ready(function () {
  
      /* Add a listeners to ADD PART */   
          $('#addPart').click(function() {                                
              var xml = $($.parseXML(testXML));           
              xml.find("DtlFields").each(function () {
                  var XMLString= $(this);             
                  fnAddPart(XMLString);                               
              });     
              return false;
          });   
  
      // add a part section to a Group on screen
      function fnAddPart(XMLString){
          myTmpl = $(section);                                                    
  
          if (XMLString != "" ){
  
              // set Quantity - this works
              var x =((XMLString).find("QTY").text());
              myTmpl.find("input[name='QTY']").attr('value', x);          
  
              // ************ set Activity - but this does not work! ***************
              var x =((XMLString).find("ACTC").text());           
              myTmpl.find("input[name='ACTC']").attr('value', x); 
  
          }       
          // append to page
          myTmpl.appendTo("#placeholder"+currentTab).page();                                                      
      }
  });
  
  &lt;/script&gt;       
  </code></pre>