如何更改<input type = Date>的特定日期的颜色?

Sye*_*war 7 css jquery html5 calendar date

有没有办法改变HTML 5的输入类型日期的样式(即颜色)在HTML 5我们可以显示日历<input type=date> 现在让我们说3月23日是假日,我想用红色显示这个具体的日期,我该怎么办?那个?

我想在打开日历时更改特定日期的颜色,以便客户端可以看到它,就像我在下面的图片中使用Jquery插件实现的那样 在此输入图像描述

Tan*_*may -1

以下是执行此操作的 jQuery 方法。

   $('input[type="date"]').change(function{    
        var date = new Date( this.value );
        var specificDate = "23 March 2018";
        if(date.getDay() == 6 || date.getDay() == 0 ||  this.value == specificDate) { //Check for Saturday or Sunday
           $(this).css("color","red"); 
        }
        else {
           $(this).css("color","inherit"); 
        }
    });
Run Code Online (Sandbox Code Playgroud)