title: How to find an option tag with a specific value using jQuery
body: <p>I'm trying to set an option with a specific value as selected (using jQuery). I've got a string:</p>
  <pre><code>var data = '&lt;select&gt;&lt;option value=&quot;1&quot;&gt;A&lt;/option&gt;&lt;option value=&quot;2&quot;&gt;B&lt;/option&gt;&lt;option value=&quot;3&quot;&gt;C&lt;/option&gt;&lt;/select&gt;';
  </code></pre>
  <p>Now I'm trying to find the option tag with value=2 and set it as selected</p>
  <pre><code>$(data).find('option[value=2]').attr('selected','selected');
  </code></pre>
  <p>It's not working. I also tried:</p>
  <pre><code>$(data).find('option').each(function(){
  if($(this).val()==2){
      $(this).attr('selected','selected');
  }
  });
  </code></pre>
  <p>which did not work either. How can I make this work?</p>