title: how to set select option selected by value from database?
body: <p>I have created registration page and Edit page which contains 3 select options. While registering a user I store the data in database which contains the select option value when user click on the edit page I am able to fill the text fields with the data that I fetch from data base but I am not able to select the   select option which the value that I get from data base the code which I used to do this is:</p>
  
  <p>the <code>company</code> variable store the data of option value from data base </p>
  
  <pre><code>&lt;select name="select-choice-a" id="select-choice-a" data-native-menu="false" data-theme="a"&gt;
       &lt;option&gt;Select Company&lt;/option&gt;
          &lt;option value="standard"&gt;facebook&lt;/option&gt;
          &lt;option value="rush"&gt;Linked In&lt;/option&gt;
          &lt;option value="express"&gt;Skype&lt;/option&gt;
          &lt;option value="overnight"&gt;Twitter&lt;/option&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>function fetchdetails(){
  db.transaction(function(tx){
      tx.executeSql(select_details,[ids,nam1],function(tx,results){
          for(var i=0;i&lt;results.rows.length;i++){
          first_name=results.rows.item(i).frist_name;
          last_name=results.rows.item(i).last_name;
          company=results.rows.item(i).company;
          title=results.rows.item(i).title;
          industry=results.rows.item(i).industry;
          owner=results.rows.item(i).owner;
          email=results.rows.item(i).email;
          landline=results.rows.item(i).landline;
          mobile_no=results.rows.item(i).mobile;
          fax_no=results.rows.item(i).fax_no;
          website=results.rows.item(i).website;
          street=results.rows.item(i).street_name;
          city=results.rows.item(i).city;
          region=results.rows.item(i).region;
          pincode=results.rows.item(i).pincode;
          country=results.rows.item(i).country;
          linkedin=results.rows.item(i).linkedin_link;
          twitter=results.rows.item(i).twitter_link;
          facebook=results.rows.item(i).facebook_link;
          skype=results.rows.item(i).skype_link;
          additionalinfo=results.rows.item(i).additional_info;
  
          }
      });
  });
  }
  
  var index='';
  var x=document.getElementById('select-choice-a');
  alert(x.options.length);
  for(var i=0;i&lt;x.options.length;i++){
      if(x.options[i].value===company)
          {
          alert("I am in select option"); 
          index=i;
          alert("index of select-choice-a"+index);
          break;
          }
  }
  x.options[index].selected=true;
  </code></pre>