title: Setting select box using jQuery on document ready
body: <p>Can anyone suggest how I get to change the selected item in a select menu with jQuery - I've tried the following but without success. Using this snippet how would I use jQuery to set to value '5' for example (eg Cambridgeshire) as the 'selected' value.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function() {
      $('#county_id option[value=3]').attr('selected', 'selected');
  });
  
  &lt;html&gt;
  &lt;select name="county_id" id="county_id"&gt;
  &lt;option value="1"&gt;Bedfordshire&lt;/option&gt;
  &lt;option value="2"&gt;Berkshire&lt;/option&gt;
  &lt;option value="4"&gt;Buckinghamshire&lt;/option&gt;
  &lt;option value="5"&gt;Cambridgeshire&lt;/option&gt;
  &lt;/select&gt;
  &lt;/html&gt;
  </code></pre>