Group entries older than x years under common filter

February 24, 2018, at 08:16 AM

I'm having some trouble and would greatly appreciate any help. I have a list of dated entries that I'm filtering by year. There are buttons for each year. However, all entries older than 5 years should be grouped under a common filter/button ("older") and displayed when the button is clicked. The trouble is, of course, that the entries to be targeted change every year and I don't know how to compute finding the relevant entries.

First there is a row of "buttons":

<div id="years">
    <p id="filter-2018" class="button filter" data-year="2018">
    <p id="filter-2017" class="button filter" data-year="2017">
    <p id="filter-2016" class="button filter" data-year="2016">
    ... (list of years)
    <p id="older" class="button">

This is how the entries are set up:

<div id="content-left-dates">
    <a href="termine/tragedie.html">
        <div class="date-entry filter-2017">
                2017/01 – 2017/03
                La Tragédie de Carmen
    ... (repeat)

This is the jQuery of how I filter the entries, order the buttons and show/hide the entries for each year:

var $btns = $(".button").click(function () {
var $wrapper = $('#years');
$wrapper.find('.filter').sort(function (a, b) {
    return +b.dataset.year - +a.dataset.year;
$('#years p').click(
    function () {
        var show =;
        $('#content-left-dates > a > div.' + show).show();
        $('#content-left-dates > a > div:not(".' + show + '")').hide();
        return false;

I only want to display the first 5 buttons and then add a button to display all entries older than 5 years. I have worked this out:

$('#years .filter:gt(4)').hide();

Now I am stuck with actually targeting the right entries. Can anybody help? Thanks a lot in advance!

Rent Charter Buses Company
Ajax File Uploading

Ajax File Uploading

Im trying to submit a form that has a file input via ajaxI have a few important things that need to happen

Jquery to detect mobile and show code based upn conditions

Jquery to detect mobile and show code based upn conditions

I am trying to run a code in a single page which is a html page that if the website is opening in mobile or desktop, i found this tutorial but not sure how to use it

Increment and decrement buttons

Increment and decrement buttons

I am novice in jQuery but trying to learn something very basicI am just trying to build up auto increment/decrement input fields like this:

Using Haskell&#39;s GHCI through a Java Program

Using Haskell's GHCI through a Java Program

What I would like to do is wrap my Java program around the GHCIIn my mind it should work like this: