currentMonth.js

/*reference : http://stackoverflow.com/questions/22854113/jquery-addclass-to-current-month-coupon-over-two-separate-years*/

by guest271314

HTML

<div id="blue-colum" class="monthly-coupon-column">
    <ul>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-may-2014.png" width="312" height="240" alt="2014-05 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-august-2014.png" width="312" height="240" alt="2014-08 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-november-2014.png" width="312" height="240" alt="2014-11 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-february-2015.png" width="312" height="240" alt="2015-02 Coupon" /></li>   
    </ul>
</div>
<div id="pink-colum" class="monthly-coupon-column">
    <ul>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-june-2014.png" width="312" height="240" alt="2014-06 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-september-2014.png" width="312" height="240" alt="2014-09 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-december-2014.png" width="312" height="240" alt="2014-12 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-march-2015.png" width="312" height="240" alt="2015-03 Coupon" /></li>    
    </ul>   
</div>
<div id="green-colum" class="monthly-coupon-column">
    <ul>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-july-2014.png" width="312" height="240" alt="2014-07 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-october-2014.png" width="312" height="240" alt="2014-10 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-january-2015.png" width="312" height="240" alt="2015-01 Coupon" /></li>
        <li><img class="month-offer" src="images/monthly-online-offers/coupon-april-2015.png" width="312" height="240"...

CSS

.month-offer.this-month
{    
    background : blue;
    color : #fff;
    transform:scale(1.05);
    -ms-transform:scale(1.05);
    -moz--transform:scale(1.05);
    -o-transform:scale(1.05);
    -webkit-transform:scale(1.05);
}

JavaScript

/* reference : http://stackoverflow.com/questions/22854113/jquery-addclass-to-current-month-coupon-over-two-separate-years */
$(function() {
    (function(month) {
      $("[alt^="+month+"]").addClass("this-month");
    })(new Date().toJSON().substr(0,7));

    /*!
    example, 
   `this month`
    remove below at live page 
    */   
   
    (function(month) {
      $("[alt^="+month+"]").addClass("this-month");
    })("2014-05");
})