Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
Jquery adds items to the drop-down list without duplicates

I want to add element to my drop-down list wihtout duplicates

for (var i = 0; i < queues.entities.length; i++) {
      var queuesName = queues.entities[i].name;

 $("#brandFilter").append(
        $(new Option(queues.entities[i].name.substring(0, 2)))
      );
     
    }

Here is my list

 <div>
                  <b>Brand</b>
                  <select
                    class="form-control input-sm form-control-sm border-0 brandFilter"
                    id="brandFilter"
                    multiple
                    size="3"
                  >
                    <option value="-" selected>--- All ---</option>
               </select>
                 <hr />
                </div>

Thank You So much

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

An easy solution would be to remove the duplicates entities first.

  const uniqueQueuesEntities = [...new Set(queues.entities)];

  for (var i = 0; i < uniqueQueuesEntities.length; i++) {
    var queuesName = uniqueQueuesEntities[i].name;

    $("#brandFilter").append(
      $(new Option(uniqueQueuesEntities[i].name.substring(0, 2)))
    );
  }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!