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

249
Views
Mover Div a Otro Div si la fecha es antigua

Tengo una página web para todos los eventos, hay dos secciones de eventos próximos y eventos pasados, ambas secciones tienen varios divs, si la fecha del div en el próximo evento es anterior a la actual, debería moverse automáticamente a los eventos pasados y debería eliminarse de los próximos eventos.

Ya tengo una función para ordenar los divs por fecha

El fragmento a continuación es uno de mis divs y fuction para ordenar.

 // Function to sort the events by date. function ddmmyyyy(s) { var part = s.split(/\//), date = new Date(); date.setYear(part[2]); date.setMonth(part[1] - 1); date.setDate(part[0]); return date; } // In Descending Order function ddmmyyyClassSortDescending(a, b) { var A = ddmmyyyy(a.getAttribute("data-event-date")), B = ddmmyyyy(b.getAttribute("data-event-date")); return A < B ? 1 : -1; } // In Ascending Order function ddmmyyyClassSortAscending(a, b) { var A = ddmmyyyy(a.getAttribute("data-event-date")), B = ddmmyyyy(b.getAttribute("data-event-date")); return A > B ? 1 : -1; } $.fn.sortChildren = function(cmp) { var self = this, children = $.makeArray(this.children()).sort(cmp); $.each(children, function(i, child) { self.append(child); }); return self; }; $(function() { $(".past-Events").sortChildren(ddmmyyyClassSortDescending); });
 <div id="past-Events">Past Event <div class="shadow p-3 mb-5 bg-white rounded" id="distinguished-Lectures" data-event-date="15/12/2021"> <center> <b> <h5> <font color="#183a1d">IMSc Distinguished Lecture</font> </h5> </b> </center> </div> </div>

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!