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 ShahRank #42 · 34.2K reputationPosted Aug 11, 2017, 6:50 AM EDT
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 VendhanRank #2,971 · 486 reputationPosted Aug 11, 2017, 6:47 AM EDT