Current Picker Date in Form

0

Hello, I use datepicker to add the date, but I would like it as soon as I open the site the current date already appears in the form.

 /* Portuguese initialisation for the jQuery UI date picker plugin. */
( function( factory ) {
if ( typeof define === "function" && define.amd ) {

    // AMD. Register as an anonymous module.
    define( [ "../widgets/datepicker" ], factory );
} else {

    // Browser globals
    factory( jQuery.datepicker );
}
}( function( datepicker ) {

datepicker.regional.pt = {
closeText: "Fechar",
prevText: "Anterior",
nextText: "Seguinte",
currentText: "Hoje",
monthNames: [ "Janeiro","Fevereiro","Março","Abril","Maio","Junho",
"Julho","Agosto","Setembro","Outubro","Novembro","Dezembro" ],
monthNamesShort: [ "Jan","Fev","Mar","Abr","Mai","Jun",
"Jul","Ago","Set","Out","Nov","Dez" ],
dayNames: [ "Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado" ],
dayNamesShort: [ "Dom","Seg","Ter","Qua","Qui","Sex","Sáb" ],
dayNamesMin: [ "Dom","Seg","Ter","Qua","Qui","Sex","Sáb" ],
weekHeader: "Sem",
dateFormat: "dd/mm/yy",
firstDay: 0,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: "" };
datepicker.setDefaults( datepicker.regional.pt );
return datepicker.regional.pt;

} ) );
    
asked by anonymous 08.08.2018 / 18:26

1 answer

0

To insert a default date into the datepicker, use the setDate method. For more methods check out documentation .

$.datepicker.setDefaults( $.datepicker.regional[ "pt-BR" ] );
$("#date").datepicker({minDate: 0}).datepicker("setDate", "0");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><linkhref="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"></script><scriptsrc="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/i18n/jquery-ui-i18n.min.js"></script>  
<input type="text" id="date" />
    
08.08.2018 / 18:47