title: Using Jquery to reset a select box
body: <p>I'm having difficulty with using jQuery to reset a value of a select box. My code is as follows:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form id="myform"&gt;
    &lt;select name="myselect" id="myselect" value=""&gt; 
      &lt;option value=""&gt;Default&lt;/option&gt;
      &lt;option value="1"&gt;Option 1&lt;/option&gt;
      &lt;option value="2" selected&gt;Option 2&lt;/option&gt;
      &lt;option value="3"&gt;Option 3&lt;/option&gt;
    &lt;/select&gt;  
    &lt;input type="submit" value="Go"&gt;
    &lt;input type="reset" class="reset" value="Reset form"&gt;  
  &lt;/form&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>​$("#myform .reset").click(function() {
      $('#myselect').attr('value','');
      alert($('#myselect').attr('value'));
  });​
  </code></pre>
  
  <p>As you can see option 2 is selected, but I want to reset the select box to "Default". I've tried various methods including attr->selectedIndex but all have the same affect, it briefly changes to Default (As can be seen if you look at the form when the "Alert  box" pops up, but as soon as the alert box is closed, or the alert line removed, it jumps back to the currently selected option 2.</p>
  
  <p>I think this may be a jQuery bug, I've tried many different versions, from 1.6 to edge, all with same effect.</p>
  
  <p>For ease I've added a jsfiddle: <a href="http://jsfiddle.net/ux2f2/1/" rel="noreferrer">http://jsfiddle.net/ux2f2/1/</a></p>
  
  <p>Hope I've included everything as this is my first post, but im a long time reader :) Love this site!</p>