Try this line afterwards to rectify the issue:
$(".datepicker").each(function() {
$(this).datepicker();
$(this).datepicker("option", "changeYear", true);
$(this).attr("value", "11-11-2016");
});
If the attributes are dynamic per $(".datepicker"), then use the following:
function getElemAttributes(var element) {
var attrs = {};
var attrMap = element.attributes;
$.each(attrMap, function (i, e) { attrs[e.nodeName] = e.nodeValue; });
return attrs;
}
to get all of the attributes as an object. So:
$(".datepicker").each(function() {
$(this).datepicker();
// Returns something like { id: "datepicker", ..., value: "11-11-2016" }
var originalAttributes = getElemAttributes(this);
// Do stuff that affects attr on element.
$(this).datepicker("option", "changeYear", true);
// Set element attributes from riginal attributes object.
if (originalAttributes.hasOwnOroperty("value")) {
$(this).attr("value", originalAttributes["value"]);
}
else {
// Didn't originally have a "value" attribute - set some default here?
}
});