Bootstrap datepicker hide after selection

Total Post:9

Points:63
 543  View(s)
Ratings:
Rate this:

I want to hide the date picker after date selection

$('#dp1').datepicker({

    format: 'mm-dd-yyyy',
    startDate: '-15d',
    autoclose: true,
    endDate: '+0d' // there's no convenient "right now" notation yet
});

Any help would be appreciated.

  1. Post:52

    Points:366
    Re: Bootstrap datepicker hide after selection

    You can use event changedate() to keep track of when the date is changed together with datepicker('hide') method to hide the datepicker after making selection:

    $('yourpickerid').on('changeDate', function(ev){
    
        $(this).datepicker('hide');
    });


  1. Post:140

    Points:984
    Re: Bootstrap datepicker hide after selection

    if u want to hide the date picker after date selection than attempting to type in the date can cause that behavior which is you did not use. so, use autoclose it's helpful. 

    $('#input').datepicker({autoclose:true});

    Another way for write to datepicker is shown below:

    locales , without icon , linked picker ,disabled days. 

    use functions for date pickers.

    $(function () {
    
            $('#datetimepicker').datetimepicker();
            $('#datetimepicker').datetimepicker({
                useCurrent: false
            });

    Happy Coding :)


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!