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

121
Views
select onChange notworking

I have a sort function that is working when using a div and an a tag. But when change to a select option, it does not work.

         <select id="sort-container" onchange="sortCards()">

                <option>
                    <a href="javascript:sortCards('peoplecard', 'Services')">
                        Business 1
                    </a>
                </option>

                <option>
                    <a href="javascript:sortCards('peoplecard', 'Architect')">
                        Business 2
                    </a>
                </option>

                <option>
                    <a href="javascript:sortCards('peoplecard', 'Law')">
                        Business 3
                    </a>
                </option>
          </select>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You need to pass arguments to the sortCards() function. You can put the second argument in the value of each option, and use this.value to get it.

<select id="sort-container" onchange="sortCards('peoplecard', this.value)">
  <option value='Services'>
    Business 1
  </option>

  <option value='Architect'>
    Business 2
  </option>

  <option value='Law'>
    Business 3
  </option>
</select>
about 4 years ago · Juan Pablo Isaza Report

0

Change your html structure to this:

<select id="sort-container">
    <option value="services">
        Business 1
    </option>

Get select tag value in sortCards function:

const val = document.getElementById('sort-container').value;
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!