Skip to content

Instantly share code, notes, and snippets.

@beardedtim
Created February 19, 2016 18:02
Show Gist options
  • Save beardedtim/3b344109ddcf14ff6249 to your computer and use it in GitHub Desktop.
Save beardedtim/3b344109ddcf14ff6249 to your computer and use it in GitHub Desktop.
// We create an object of the specific divs we want to sort
var games = jQuery('.future-games-box .single-game-listing-box');
// then we create a function to
var orderedDivs = jQuery(games).sort(function(a,b){
// We are targeting the text, which is a date, inside of the
// <p></p> that is inside of the div .single-listing-box
return jQuery(a).find("p").html() > jQuery(b).find("p").html();
});
jQuery(".future-games-box").html(orderedDivs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment