title: Jquery - Set selected option by value not working
body: <p>I've tried all the solutions from google.  What am I missing?  The option I want is not being selected.
  Here's the section of code i'm having trouble with.  I've  included some other things I've tried (commented out).</p>
  
  <p>If it matters, this list is built dynamically, but the code to select it by value is after that process.
  i'm in Chrome Version 80.0.3987.149</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// EDIT ADDED THIS CODE FROM MY APPLICATION
  const url = '/api/Customers';
  
  // Populate dropdown
  $.getJSON(url, function (data) {
      $.each(data, function (key, entry) {
          dropdown.append($('&lt;option&gt;&lt;/option&gt;').attr('value', entry.CustomerID).text(entry.Name + ' - ' + entry.Email));
      })
  });
  // END EDIT ^^^^^
  
  //var customerID = window.location.hash;
  var customerID = "6a1920b2-f388-4790-a720-75048e1407a7"; //Test User 5
  console.log(customerID);
  
  //$('#customer-dropdown option[value="'+ customerID +'"]').prop('selected', true);
  //$("#customer-dropdown select").val(customerID);
  $("#customer-dropdown option[data-value='" + customerID +"']").attr("selected","selected");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;select id="customer-dropdown" name="c15905d7-8216-4e81-ac15-2fafd10b49e8"&gt;
   &lt;option disabled=""&gt;Select Customer&lt;/option&gt;
   &lt;option value="297f8676-80bf-43e5-b463-031a5b5154aa"&gt;Test User 1&lt;/option&gt;
   &lt;option value="83941899-8039-488f-bf6b-0d036c7d6556"&gt;Test User 2&lt;/option&gt;
   &lt;option value="263356fd-d803-4436-a7fc-4df5a3095771"&gt;Test User 3&lt;/option&gt;
   &lt;option value="2e31ee49-b096-4237-b07e-61071871334d"&gt;Test User 4&lt;/option&gt;
   &lt;option value="6a1920b2-f388-4790-a720-75048e1407a7"&gt;Test User 5&lt;/option&gt;
   &lt;option value="072f6800-570c-4004-b9cd-7bdb4cf98b0a"&gt;Test User 6&lt;/option&gt;
   &lt;option value="c957f2c0-f72e-4de7-9b4f-9272cbbfd783"&gt;Test User 7&lt;/option&gt;
   &lt;option value="d870225f-c020-4369-bd7b-9dc5d16f34a1"&gt;Test User 8&lt;/option&gt;
  &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>