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

131
Views
¿Cómo verificar con jquery si select tiene opciones?

¿Cómo verificar con jquery si la selección tiene opciones y si no las tiene para deshabilitarlas y mostrar [no elementos]?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Una forma de hacerlo:

 if ($('#myselect option').length == 0) { $('#myselect').hide(); }
over 4 years ago · Santiago Trujillo Report

0

var $select = $('input:select option'); if(!$select.length ) $select.attr('disabled', true);

O:

 $('select:not(:has(option))').attr('disabled', true);
over 4 years ago · Santiago Trujillo Report

0

Otra forma de hacerlo es simplemente usar la función jQuery has

 if ($('#myselect').has('option').length == 0) { // Hide and disable select input here }

Para obtener información sobre la función jQuery has , consulte: https://api.jquery.com/has/

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!