En curso

Need assistance creating a button to sort divs by data value.

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>

Habilidades: Javascript, jQuery / Prototype

Ver más: data structure quick sort, data structure heap sort, data structure bubble sort, software write mq4, software write chip epson, useful software write book, software write web specs, software write edid, software write websites idea, software write book images, software write books, software write protection, free software write book, software write book, javascript display form value, need example script, software write technical manual, need example article review

Información del empleador:
( 3 comentarios ) Denver, United States

ID de proyecto: #12776167

Adjudicado a:

ravindrababbar6

Hi There, Greeting for you.!!!.. I have reviewed your job description very carefully and As per your requirement of an expert Web developer ,I feel that I'm exact match for this position: I'm an expert web dev Más

$25 USD en 1 día
(0 comentarios)
0.0

6 los freelancers están ofertando un promedio de $24 para este trabajo.

aleem18

Elambak.com (Valley of Solution): Who We Are: We're developers and management team to facilitate you after working on many projects we are now focusing only to develop website of various kinds of different countri Más

$21 USD en 10 días
(2 comentarios)
1.9
shanymathew

Dear Sir, I am very good in PHP,MYSQL,AJAX,Jquery,Javascript,HTML,CSS, excellent in Codeigniter framework. I can do your work with 100% perfection.I am sure my work will be worth and pleasure for you. I am very h Más

$25 USD en 1 día
(2 comentarios)
0.7
kartikeyagupta

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

$25 USD en 1 día
(0 comentarios)
0.0
saifansari2

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

$25 USD en 30 días
(1 comentario)
0.0
$20 USD en 2 días
(0 comentarios)
0.0