我使用的是JQuery UI Datepicker,当代码运行并使用日期选择器时,它有时会打开一个空白的网页。关于如何解决这个问题的任何想法?
var viewDashboardJobs = (function viewDashboardJobs() {
var _create = function _create() {
var input09 = window.document.createElement("input");
input09.setAttribute("id", "agency-brief-date");
input09.setAttribute("type", "text");
input09.setAttribute("name", "agency-brief-date");
input09.setAttribute("title", "Please provide the agency brief date.");
window.document.body.appendChild(input09);
var agencyBriefDate = window.document.createElement("button");
agencyBriefDate.setAttribute("type", "button");
agencyBriefDate.setAttribute("onclick", "viewDashboardJobs.pickDate(document.querySelector('#agency-brief-date'));");
agencyBriefDate.innerHTML = "Pick a date";
window.document.body.appendChild(agencyBriefDate);
};
var _pickDate = function _pickDate(node) {
node.value = "";
var id = "#" + node.id;
$(id).datepicker($.datepicker.regional['en']);
$(id).datepicker("option", "dateFormat", "dd/mm/yy" );
$(id).datepicker();
$(id).datepicker("show");
$(id).mouseover(function(e) {
$(this).datepicker("destroy");
});
};
return {
create : _create,
pickDate : _pickDate
}
})().create();