Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 完整日历选择阵列/列表中的所有日期?_Javascript_Jquery_Arrays_Fullcalendar_Each - Fatal编程技术网

Javascript 完整日历选择阵列/列表中的所有日期?

Javascript 完整日历选择阵列/列表中的所有日期?,javascript,jquery,arrays,fullcalendar,each,Javascript,Jquery,Arrays,Fullcalendar,Each,我有特定日期的数据,我需要在完整日历上选择这些日期。但是,我在选择这些日期时遇到了一些问题。我已经设置了传入日期的格式,以匹配日历的数据日期属性的格式。因此-对于每个日期(class.fc day),如果此.fc day属性数据日期等于日期列表中的日期,请选择该日期 var dates = ["2014-10-20", "2014-10-21"]; $('.fc-day').each(function () { var thisdate = $(thi

我有特定日期的数据,我需要在完整日历上选择这些日期。但是,我在选择这些日期时遇到了一些问题。我已经设置了传入日期的格式,以匹配日历的数据日期属性的格式。因此-对于每个日期(class.fc day),如果此.fc day属性数据日期等于日期列表中的日期,请选择该日期

var dates = ["2014-10-20", "2014-10-21"];


        $('.fc-day').each(function () {
            var thisdate = $(this).attr('data-date');
            var td = $(this).closest('td');

            if (thisdate == "2014-10-20") {
            //if (thisdate == dates) {
            //if ($.inArray($(this).attr('data-date'), dates) !== -1) {
            //if (dates.indexOf(thisdate) >= 0) {
                td.addClass('fc-state-highlight');
            } else {
                td.removeClass('fc-state-highlight');
            }
        });

如果您使用您注释掉的代码,则有效
如果($.inArray($(this).attr('data-date'),dates)!=-1){…
尝试过,没有区别。可以在实时HTMLID中看到应用的类除了注释/取消注释之外,您还更改了什么吗?不适用于我。粘贴保存的链接吗?