I want to set and render the current date in my text box when page loads as default.
I could not able to do it. This is my code. Its not working.
Please look at and help me out.
$(document).ready(function () {
$('#dtID').datepicker({
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
duration: 'fast',
dateFormat: 'mm/dd/yy',
onSelect: function (date) {
$scope.txtDate = date;
$scope.$apply();
}
}).setDate(new Date());
});
Nilesh ShahPosted Aug 11, 2017, 10:50 AM
that's because setdate is a property, but you are using it as a function.
it should be written like:
.datepicker("setDate", new Date());
find below whole working code.Mukil VendhanPosted Aug 11, 2017, 10:47 AM