title: How to create a dynamic SELECT drop-down list in JavaScript/jQuery?
body: <p>I want to display the all the department names in the Dept Table in a combo box.
  I have a function which fetches all the Dept name.
  How can I dynamically create combo box in runtime, using javaScript or jQuery.</p>
  
  <p><strong>HTML CODE</strong></p>
  
  <pre><code>     &lt;select id="searchDepartments"&gt;
       &lt;/select&gt; &lt;input type="button" value="Search" onClick="search();" /&gt;
  </code></pre>
  
  <p><strong>JavaScript function</strong></p>
  
  <pre><code>function getDepartments(){
  EmployeeManagement.getDeptList(function(deptList/*contains n-(dept.id, dept.name)*/{
      for(i = 0; i&lt;deptList.length; i++){
  </code></pre>
  
  <p>How can I able to write a code that generates(adds) options to the list?</p>