I'm implementing edit user functionality. This is my jquery code for datepicker
$('#companybegindate').datepicker({
autoclose: true,
dateFormat: 'yy',
changeYear: true
});
And this is HTML
<input type="text" class="form-control pull-right" name="companybegindate" id="companybegindate" value="">
My question is if I'm fetching any date from database , how can i set that date to datepicker by default ??
Suppose I'm getting '2016-06-20', how can I set this date to datepicker by default. Any help is much appreciated..Thanks.
<input type="text" class="form-control pull-right" name="companybegindate" id="companybegindate" value="2016-06-20">
You may set date ('2016-06-20') directly to value attribute of input so it will be a default value.
Or You may use folowing to set it with java script.
$("#companybegindate").datepicker( "setDate" , "2016-06-20" );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With