How to make this function in JQuery?

This is a rather simple task, so instead of giving complete solution let me help you to make it yourself.

First of all, let’s write an algorithm that will describe what we want to achieve:

  1. Hold two values (prevYear, nextYear) in memory;
  2. Output each of them into corresponding div on the page;
  3. When user clicks “back”:
    3.1. Decrease prevYear value (substract 1 from it);
    3.2. Output new prevYear value into corresponding div;
  4. When user clicks “next”:
    4.1. Increase nextYear value (add 1 to it);
    4.2. Output new nextYear value into corresponding div;

Then let’s think what tools we can use to implement that algorithm:

  1. To store and manipulate with values we can use variables;
  2. To output values there is jQuery’s html() method;
  3. To listen for user clicks there is jQuery’s click() method that you’re already using.

Now, try to implement final solution.
Feel free to ask if you’ll stuck somewhere.