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

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