title: set the dropdown value to the given ID
body: <p>I wonder if it is possible to set an HTML dropdown menu to the option matching a given id using jquery. I need this for editing some data.</p>
  
  <pre><code>&lt;td id="4" class="d" &gt; IT Department &lt;/td&gt;
  
  &lt;select id="department"&gt;
    &lt;option value="1"&gt;Admin&lt;/option&gt;
    &lt;option value="2"&gt;Sales&lt;/option&gt;
    &lt;option value="3"&gt;HR&lt;/option&gt;
    &lt;option value="4"&gt;IT&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>In jquery:</p>
  
  <pre><code>$(".d").click(function(){
      var depid = $(this).attr('id'); // get the id of the department
      $("#department").val(depid); // make the IT option of the menu selected
  });
  </code></pre>
  
  <p>I hope I am well understood. any help is greatly appreciated!</p>