Need assistance creating a button to sort divs by data value.
$10-30 USD
Pagado a la entrega
Need jquery/javascript to sort divs by date. Script should sort asc and desc based on a button click. Value z is a null value and should be placed on the bottom always. Tried something like this:
("#sort").click(function() {
$(".date").sort(function(a,b){
var datea =Date($(a).attr("data-date"));
return new Date($(a).attr("data-date")) < new Date($(b).attr("data-date"));
}).each(function(){
$("#mainideas").prepend(this);
})
});
Doesn't work, results aren't consistent.
Below is an example:
<div id="mainideas">
<div class="New allstatus status date" data-date="z">
</div>
<div class="New allstatus status date" data-date="z">
</div>
<div class="New allstatus status date" data-date="Sun Jan 29 00:00:00 GMT 2017">
</div>
<div class="New allstatus status date" data-date="Sat Jan 28 00:00:00 GMT 2017">
</div>
<div class="New allstatus status date" data-date="Mon Feb 6 00:00:00 GMT 2017">
</div>
</div>
Nº del proyecto: #12776167
Sobre el proyecto
5 freelancers están ofertando un promedio de $23 por este trabajo
I can do it right now as you needed. Develop Web Application, Mobile Application,UI layout with latest Technologies like Angularjs,HTML5,CSS3, Canvasjs Reporting, ionic framework, Jquery,JSON,WCF,Ms Sql Server, MVC or Más
Hey this is kartikeya with 3+ years of experience in web development with jquery and other javascript frameworks. I will quite confident about the job. Feel free to ping me