 <p>I came up with a similar solution, here's the general gist. (I've got a working example at the bottom too)</p> <pre><code>var year = [], yearWatch = 2015; Year[2015] = ["Jan", "Feb", "Sep", "Dec"]; Year[2016] = ["Apr", "May", "Oct", "Nov"]; disableFromVar = function() { $('#txtCalendar .month').removeClass('disabled'); $('#txtCalendar .month').each(function(i, v) { if (jQuery.inArray($(v).html(), Year[yearWatch]) &gt; -1) { $(v).addClass('disabled'); } }); } </code></pre> <p><a href="http://jsfiddle.net/link2twenty/5psu9tf8/" rel="nofollow">http://jsfiddle.net/link2twenty/5psu9tf8/</a></p>