How do I set the date of Bootstrap Datepicker to null?

Asked

Viewed 40 times

1

When I send the data for validation, it is stated that the field has a completed date, like today’s date. I would like to set as null at first obliging the user to fill in the field.

DATEPICKER

   $('#datepicker')
        .datepicker({
         format: "dd/mm/yyyy",
         language: "pt-BR",
         orientation: "top auto",

    });

JAVASCRIPT

 $(document).ready(function(){
         if ($( "#tipo_retorno" ).val() == "AGENDAMENTO"){

                $("div.atendimento-simples").hide();
                $("div.atendimento-agendamento").show();
            }
   });

        $(document).ready(function(){
        $('#tipo_retorno').on('change', function(){
    var demovalue = $(this).val();

    if(demovalue == "AGENDAMENTO") {

       $("div.atendimento-simples").hide();
        $("div.atendimento-agendamento").show();

            }else{
        $("div.atendimento-simples").show();
        $("div.atendimento-agendamento").hide();
    }


});
});

1 answer

1


Try to use defaultDate

$('#datepicker')
        .datepicker({
         format: "dd/mm/yyyy",
         language: "pt-BR",
         orientation: "top auto",
         defaultDate: '00/00/0000'
    });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.