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

225
Views
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 answers
Answer question

0

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

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 Report

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 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!