📜  html 设置输入类型日期以禁用以前的日期 - Html 代码示例

📅  最后修改于: 2022-03-11 14:53:12.381000             🧑  作者: Mango

代码示例1
$(function(){
    var dtToday = new Date();
    
    var month = dtToday.getMonth() + 1;
    var day = dtToday.getDate();
    var year = dtToday.getFullYear();
    if(month < 10)
        month = '0' + month.toString();
    if(day < 10)
        day = '0' + day.toString();
    
    var maxDate = year + '-' + month + '-' + day;
    alert(maxDate);
    $('#txtDate').attr('min', maxDate);
});