Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

126
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda