title: Show only current and future months in a Select element if current year was chosen
body: <p>I'm creating a form for a credit card payment. 
  As part of the form, I also collect the expiration date details of the client's card.</p>
  
  <p>The month and year fields are both of a Select element type within the HTML.</p>
  
  <p>What I want to do, using jQuery or JavaScript, is, in case the client chooses current year from the list of available years, previous months will be removed from the list of options, and if a past month was already selected, the value in the month field should reset by default to be current month selected.
  In case he changes the year value again to a future year, all months should be shown again.</p>
  
  <p>Basically what I'm trying to achieve here is, making sure the client can't choose a past date for a CC expiry date, instead of using validations and showing alerts in case he does.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Well, I haven't tried anything yet as I'm not experienced much with front-end, but I assume I will have to use something like:</p>
  
  <pre><code>    $(document).ready(function () {
          $("#year").change(function () {
              var date = new Date();
              var currentmonth = date.getMonth();
              var currentyear = date.getFullYear();
              var year = $(this).val();
              if (year == currentyear) {
                  $("#month").html('add a loop here to add options from currentMonth to 12');
              } else {
                  $("#month").html('same as above but from 1 to 12');
              }
          });
      });
  </code></pre>
  
  <p>I'm just not sure if it's the right way to do it and if so, how to write the loop properly. Also, I don't know if I'm missing something in order for it to work.</p>