title: Adding options to HTML select via JQuery in Google app script
body: <p>I have a built a web app via Google Apps Script. I am attempting to update/add an HTML Select options via jquery based on the selection of the previous value that was chosen from the previous select.</p>
  <p>I've logged the results and my filering is working,it's just not adding it as options on the Select.</p>
  <p>The previous select option has unique value assigned to each option, the target select has multiple options with the same value. Based on the previous value I'm wanting to filter down to only show options with that value. Currently nothing is showing up to select.</p>
  <p><em>Server side:</em></p>
  <pre class="lang-js prettyprint-override"><code>function getPrimaryClinics() {
    var ss = SpreadsheetApp.openByUrl(url);
    var ws = ss.getSheetByName(&quot;Data&quot;);
    var listPS = ws.getRange(1, 1, ws.getRange(&quot;A1&quot;).getDataRegion().getLastRow(), ws.getRange(&quot;A1&quot;).getDataRegion().getLastColumn()).getValues();
  
    return listPS;
  
  } // EDITOR ADDED THIS
  </code></pre>
  <p><em>Client side:</em></p>
  <pre class="lang-js prettyprint-override"><code>var primaryClinics = [];
  $(function() {
    google.script.run.withSuccessHandler(setPses).getPrimaryClinics();
  })
  
  function setPses(pses) {
    primaryClinics.push(...pses);
  }
  
  $(&quot;#org&quot;).change(function() {
    var selectedorg = $(this).val();
    var primaryClinicSelectList = $('#PS');
  
    var filteredClinics = primaryClinics.filter(function(clinic) {
      return clinic[0] === selectedorg;
    });
  
    console.log(primaryClinicSelectList);
  
    primaryClinicSelectList.find('option[value!=&quot;default&quot;]').remove();
  
    for (var i = 1; i &lt; filteredClinics.length; i++) {
      primaryClinicSelectList.append(new Option(filteredClinics[i][1]));
    }
  
    console.log(primaryClinicSelectList);
  });
  </code></pre>
  <pre class="lang-html prettyprint-override"><code>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js&quot;&gt;&lt;/script&gt;
  &lt;div class=&quot;row&quot;&gt;
    &lt;div class=&quot;input-field col s6&quot;&gt;
      &lt;select id=&quot;PS&quot; required&gt;
        &lt;option disabled value=&quot;default&quot; selected&gt;Choose the primary clinic&lt;/option&gt;
      &lt;/select&gt;
      &lt;label&gt;Choose the primary clinic for where this provider will need a schedule&lt;/label&gt;
    &lt;/div&gt;
  </code></pre>