title: Set Dropdown List Selected Value with jQuery
body: <p>I have created a dropdown list in an ASP.NET MVC view using AJAX:</p>
  
  <pre><code>Url="/Channel/GetChannels";
  $.ajax({
      url:Url,
      dataType: 'json',
      data: '',
      success: function (data) {
          $("#ddlChannel").empty();
          $("#ddlChannel").append("&lt;option value='0'&gt;All&lt;/option&gt;");
          $.each(data, function (index, optiondata) {
              $("#ddlChannel").append("&lt;option value='" + optiondata.Id + "'&gt;" + optiondata.Name + "&lt;/option&gt;");
          });
      }
  });
  $("#ddlChannel option[value='1']").attr("selected", "selected");
  </code></pre>
  
  <p>This produces the following markup:</p>
  
  <pre><code>&lt;select id="ddlChannel"&gt;
  &lt;option value="0"&gt;All&lt;/option&gt;
  &lt;option value="1"&gt;New Homes&lt;/option&gt;
  &lt;option value="2"&gt;Sales&lt;/option&gt;
  &lt;option value="3"&gt;Lettings&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Would someone please tell me how I can select an option value using jQuery.</p>
  
  <p>I have tried:</p>
  
  <pre><code>$("#ddlChannel option[value='1']").attr("selected", "selected");
  </code></pre>
  
  <p>which doesn't work.</p>