Created
February 19, 2016 18:02
-
-
Save beardedtim/3b344109ddcf14ff6249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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