0

我正在返回一些数据服务器端,需要循环浏览日历的日期并调整 CSS。我目前正在做这样的事情:

$.post("GetMeSomeData", { year: theYear, month: theMonth }, function(data) {
            //cycle through the dates and address the CSS appropriately
            var i = 0;
            for (i = 0; i < data.length; i++) {
                $('.ui-datepicker-calendar td a:exactly(' + data[i]['d'] + ')')
                    .css({ backgroundColor: 'blue' });
            }

        });

  $.expr[":"].exactly = function (el, i, m) {
        var s = m[3];
        if (!s) return false;
        return eval("/^" + s + "$/i").test($(el).text());
    };

个别日子的背景没有改变。有没有更好的方法来做到这一点,或者我错过了什么?理想情况下,我只想使用 addClass(),因为我很确定我需要使用 '!important' 来覆盖日历上的内容。

4

0 回答 0