我们正在尝试将 HTML 内容放在 jquery 日期选择器单元格上。我们这样做了,但它工作不正常,当我们选择那一天时,文本框显示 NAN。
http://jsfiddle.net/cqf9d/2802/
setTimeout(function() {
$(".ui-datepicker-calendar td.Highlighted").filter(function() {
var date = $(this).text();
console.log(date);
return /\d/.test(date);
}).find("a").html($('#dataDiv').html()); // Add custom data here
// }).find("a").attr('data-custom', $('#dataDiv').html()); // Add custom data here
}, 0)
请告诉我们哪里做错了。
最佳答案
试试这个 -
function addCustomInformation() {
setTimeout(function() {
$(".ui-datepicker-calendar td.Highlighted").filter(function() {
var date = $(this).text();
console.log(date);
return /\d/.test(date);
}).append($('#dataDiv').html()).find("a").hide(); // Add custom data here
// }).find("a").attr('data-custom', $('#dataDiv').html()); // Add custom data here
}, 0)
}
JSFiddle这里
关于javascript - 所选日期未显示在日期选择器单元格上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39304493/