how to disable previous date in html?

how to disable previous date in html – Using min attribute and Using minDate property Actually the logic behind this is bootstrap date picker or date time picker provides an option for start date.

how to disable previous date in html?

In this article, i will learn How to disable previous dates in the date picker using JQuery. In this example i will see how to disable the previous date selection in HTML date picker.

how to disable previous date in html input type date?

JS Code

$(function(){
    var currentDt = new Date();
    
    var month = currentDt.getMonth() + 1;
    var day = currentDt.getDate();
    var year = currentDt.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);
});

JQuery code : Using min attribute


Full Source code


    
    How to disable previous dates in date picker using JQuery - Pakainfo.com
    


    

How to disable previous dates in date picker using JQuery

Date :

Don't Miss : How To Disable Previous Date In Bootstrap Datepicker?

Using minDate property


example


    
    How to disable previous dates in date picker using JQuery - www.pakainfo.com
    
    
    


    

How to disable previous dates in date picker using JQuery

Date :

I hope you get an idea about how to disable previous date in html.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment