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

187
Vistas
Jquery remove() only skips select options, rather than deleting them

Am trying to delete/remove/disable the options of a select on click of a span. I am trying to remove only those options whose values are lower than the current time (values are total minutes, I find current time and convert to total minutes, before comparing.)

HTML:

<span class="flatpickr-day today">22</span>

<div class="mvvwb_sel_wrap">
  <select name="mvvwb_timeStart">
    <option value="540">09:00</option>
    <option value="600">10:00</option>
    <option value="660">11:00</option>
    <option value="720">12:00</option>
    <option value="780">13:00</option>
    <option value="840">14:00</option>
    <option value="900">15:00</option>
    <option value="960">16:00</option>
    <option value="1020">17:00</option>
    <option value="1080">18:00</option>
    <option value="1140">19:00</option>
  </select>
</div>

JS:

$('.flatpickr-day.today').click(function () {
  var time = new Date();
  var currentTime = time.toLocaleString('en-US', { hour: 'numeric', hour12: false });
  var currentTimeMinutes = currentTime*60;
  $(".mvvwb_sel_wrap select > option").each(function() {
    var optionTime = parseInt(this.value);
    if(optionTime < currentTimeMinutes) {
      this.remove();
    }
  });
});

The 3 other ways that I tried that flat out didn't work:

this.prop('disabled',true);
this.attr('disabled','disabled');
this.css('display','none');
about 4 years ago · Juan Pablo Isaza
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