title: Is there a way to make a search bar like this?
body: <p>So i am making a search bar with javascript and jquery and i loop through a list of objects and an if statement checks if the input value includes something in my array. Then if it does include the item will get added to a select as an option and if the user removes the characters in the input the list would be empty.</p>
  <p>But i can't seem to make it work.</p>
  <p>This is what i've got:</p>
  <pre><code>&lt;input class=&quot;type&quot; value=&quot;&quot; /&gt;
  &lt;select class=&quot;opties&quot;&gt;
  
  &lt;/select&gt;
  
  $('.type').on('keyup', function() {
          let input = $('.type').val().toLowerCase();
          let pc = ['Processor', 'Ram', 'Videokaart', 'Voeding', 'SSD', 'Fans'];
  
          for(let i=0; i&lt;pc.length;i++) {
              if(!pc[i].toLowerCase().includes(input)) { 
                  $('.opties').remove(pc[i])
              } else {
                  $('.opties').append(&quot;&lt;option&gt;&quot;+pc[i]+&quot;&lt;/option&gt;&quot;)
              }
              if(input == '') {
                  $('.opties').empty();
              }
          }
      })
  </code></pre>
  <p>The output right now is a few options that are duplicates of each other.</p>