bootstrap datepicker today as default

bootstrap datepicker today as default

Asked on December 28, 2018 in Javascript.
Add Comment


  • 3 Answer(s)

    Try to do this one line code, this should works.

    $("#datepicker").datepicker("setDate", new Date());
    

    Complete example,

    $('#datepicker').datepicker({
             "setDate": new Date(),
             "autoclose": true
    });
    

    For more information about jquery here.

    Answered on December 28, 2018.
    Add Comment

    Use this code after set the lnite.

    $('#dp-ex-3').datepicker({ autoclose: true, language: 'es' });
    $('#dp-ex-3').datepicker('update', new Date());
    
    Answered on December 28, 2018.
    Add Comment

    By using this example, one can got the solution easily.

    $('#datePicker').datepicker({
                        format:'mm/dd/yyyy',
                     }).datepicker("setDate",'now');
    
    Answered on December 28, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.