Posted inJavaScript / jQuery / php

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.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype