Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.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 限制innerhtml详细信息显示到特定日期_Javascript_Jquery_Html - Fatal编程技术网

Javascript 限制innerhtml详细信息显示到特定日期

Javascript 限制innerhtml详细信息显示到特定日期,javascript,jquery,html,Javascript,Jquery,Html,我的日历结构如下 <td class="fc-day fc-mon fc-widget-content fc-future fc-first" data-date="2014-05-12"></td> <td class="fc-day fc-tue fc-widget-content fc-future" data-date="2014-05-13"></td> <td class="fc-day fc-wed fc-widget-cont

我的日历结构如下

<td class="fc-day fc-mon fc-widget-content fc-future fc-first" data-date="2014-05-12"></td>
<td class="fc-day fc-tue fc-widget-content fc-future" data-date="2014-05-13"></td>
<td class="fc-day fc-wed fc-widget-content fc-future" data-date="2014-05-14"></td>
它工作得很好。但是我的问题如果我将
innerHTML
传递给
fc tue
,它适用于每个月的所有周二。我想这只显示到一个特定的日期

附加的参考图像

您可以使用表中提供的
数据日期
属性值与所需的日期限制进行比较。 您可以通过
$(“td fc tue”).attr(“数据日期”)
提取日期,然后将其转换为日期对象进行比较

var d2 = Date.parse("12/05/14")    // Your required date

[].slice.call(divs).forEach(function (div) {
        var d1 =  Date.parse(div.attr("data-date"))
    if(d1 < d2) // check if the date is less than required date 
          div.innerHTML = div.innerHTML + items;
});
var d2=Date.parse(“12/05/14”)//您所需的日期
[].slice.call(divs).forEach(函数(div){
var d1=Date.parse(div.attr(“数据日期”))
if(d1
您可以使用表中提供的
数据日期
属性值与所需的日期限制进行比较。 您可以通过
$(“td fc tue”).attr(“数据日期”)
提取日期,然后将其转换为日期对象进行比较

var d2 = Date.parse("12/05/14")    // Your required date

[].slice.call(divs).forEach(function (div) {
        var d1 =  Date.parse(div.attr("data-date"))
    if(d1 < d2) // check if the date is less than required date 
          div.innerHTML = div.innerHTML + items;
});
var d2=Date.parse(“12/05/14”)//您所需的日期
[].slice.call(divs).forEach(函数(div){
var d1=Date.parse(div.attr(“数据日期”))
if(d1
遍历表格。检查日期是否是正确的追加位置。如果是这样,请附加您的项目。检查下面的代码

$('.fc-border-separate tr').each(function () {
    $(this).find('td').each(function () {
var eachday=$(this).attr("data-date"); //here you will get date on each td

var d1 = Date.parse(eachday);
var d2 = new Date("2014-05-09");

if(d1 <= d2)
{

$(this).append(items); //here you can append your item to td
});
}

}); //traversing through td ends here
}); //traversing through tr ends here
$('.fc border separate tr')。每个(函数(){
$(this.find('td')。每个(函数(){
var eachday=$(this).attr(“数据日期”);//这里您将获得每个td的日期
var d1=Date.parse(eachday);
var d2=新日期(“2014-05-09”);

如果(d1遍历表格。检查日期是否是正确的追加位置。如果是,追加项目。检查下面的代码

$('.fc-border-separate tr').each(function () {
    $(this).find('td').each(function () {
var eachday=$(this).attr("data-date"); //here you will get date on each td

var d1 = Date.parse(eachday);
var d2 = new Date("2014-05-09");

if(d1 <= d2)
{

$(this).append(items); //here you can append your item to td
});
}

}); //traversing through td ends here
}); //traversing through tr ends here
$('.fc border separate tr')。每个(函数(){
$(this.find('td')。每个(函数(){
var eachday=$(this).attr(“数据日期”);//这里您将获得每个td的日期
var d1=Date.parse(eachday);
var d2=新日期(“2014-05-09”);

如果(d1)发布更多代码以便我们可以处理它。发布更多代码以便我们可以处理它。我将d1编辑为vard1=Date.parse($(“td.fc-”+Newspltdays[c]).attr(“数据日期”);它工作我将d1编辑为vard1=Date.parse($(“td.fc-”+Newspltdays[c]).attr(“数据日期”);它工作正常