Skip to content

Instantly share code, notes, and snippets.

@TristanWiley
Last active March 28, 2017 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TristanWiley/606df83e3234883cc27a4b01930e922c to your computer and use it in GitHub Desktop.
Save TristanWiley/606df83e3234883cc27a4b01930e922c to your computer and use it in GitHub Desktop.
var s = '<button id="pastToggle" style="margin: 0 auto;display:block;">Show/Hide Past Hackathons</button>'; // HTML string
var div = document.createElement('div');
div.innerHTML = s;
$('.row.feature').children().get(0).append(div);
$('#pastToggle').click(function() {
$('.event').each(function(item){
var date = Date.parse($(this).find('meta[itemprop="endDate"]').attr('content'));
var currentTime = (new Date).getTime();
var inPast = date<currentTime;
if(inPast){
console.log($(this).toggle());
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment