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

232
Vistas
jQuery - check if an input is not a select field

How can I find out if an input field is anything other than a select ?

I tried with if($(el).not("select")) and I get the selects too...

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

if(!$(el).is("select")) {
    // the input field is not a select
}
over 4 years ago · Santiago Trujillo Denunciar

0

$(el).not("select") gives you array. Array is always gives true in boolean expressions. But after you apply not, this array of elements won't contain selects. See working example.

over 4 years ago · Santiago Trujillo Denunciar

0

The .not() method returns a new jQuery object with everything from the original object that doesn't match the selector.
You can't just use it in an if statement like that.

Instead, you use the .is method, which checks whether the element matches a selector and returns a boolean.

if (!$(el).is('select'))
over 4 years ago · Santiago Trujillo 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