title: JQueryUI selectmenu - How to add more options
body: <p>Through javascript how can I add more options to a dropdown selectmenu?</p>
  
  <p>Currently trying the following with no luck:</p>
  
  <pre><code>for (i = 0; i &lt; json.powerDropDownItems.length; i++) {
      //$('#powerSelect').append($("&lt;option&gt;&lt;/option&gt;").attr("value", json.powerDropDownItems[i]).text(json.powerDropDownItems[i]));
      $('#powerSelect').selectmenu("value", "nice name");
      //$('#powerSelect').appendTo("&lt;option&gt;" + json.powerDropDownItems[i] + "&lt;/option&gt;");
  }
  $('#powerSelect').selectmenu("refresh");​
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks to naveen, I got it working (also added code to clear the list). Here is my following code:</p>
  
  <pre><code> service.getPowerDropDowns(productEC, $('#mountSelect').val(), function (response) {
         var json = $.parseJSON(response.value);
  
         var options = [];
  
         // Clear the options first   
         $("#powerSelect option").each(function(index, option) {
              $(option).remove();
         });
          options.push("&lt;option value=''&gt;Choose&lt;/option&gt;");
          for (i = 0; i &lt; json.powerDropDownItems.length; i ++)
          {
              options.push("&lt;option value='" + json.powerDropDownItems[i] + "'&gt;" + json.powerDropDownItems[i] + "&lt;/option&gt;");
          }
          $('#powerSelect').append(options.join("")).selectmenu();
          $('#powerSelect').selectmenu('enable');
      });
  </code></pre>