简体   繁体   中英

How to diasable previous date in datetime picker in bootstrap datetimepicker js file

I am Used date time picker in my file with bootstrap j query calender file.and i am try this function in JavaScript. $(function() {$('#datepicker').datepicker({ maxDate: 0 });}); But this function not working in my file. and if this function used in datepicker then this function work properly.so anyone can help me how to disable previous date in bootstrap date time picker calender.

var minDate = new Date(); // Our minimum

$('.someSelector').datepicker()
.on('changeDate', function(ev){
    if (ev.date.valueOf() < minDate.valueOf()){

        /* Handle previous date */
        alert('Nope');
        // and eventually reset the date

        /* And this for later versions (just in case) */
        ev.preventDefault();
        return false;
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM