1
我有一个Web表单,我问用户几个日期。通常,但并非总是,重复日期将是人为错误。因此,在onSelect函数中,我将检查是否已输入日期,并要求用户确认重复日期是否是有意的。如果用户说“不”,如何清除选取器中的日期值?如何拒绝在jQuery UI中选择的选定日期DatePicker
// datesList initialized in outer scope
onSelect: function (thedate, picker) {
if ($.inArray(new Date(thedate).valueOf(), datesList) == -1) {
//store chosen dates in datesList if we haven't seen it before
datesList.push(new Date(thedate).valueOf())
} else {
// ask the user if it was intentional
//if unintentional, reject the choice and clear the picker
}
}
谢谢。如果重复是无意的,我喜欢不隐藏选择器的功能。 – Tim