我正在尝试使用datepicker phonegap-plugin-android(datepickerPlugin)。它工作正常,但是当我从第2个开始点击文本框时,我有问题,datepicker显示2次。
$ function callDatePicker()
{
$('.nativedatepicker').mousedown(function(event) {
var currentField = $(this);
var myNewDate = Date.parse(currentField.val()) || new Date();
if(typeof myNewDate === "number"){ myNewDate = new Date (myNewDate); }
// Same handling for iPhone and Android
window.plugins.datePicker.show({
date : myNewDate,
mode : 'date', // date or time or blank for both
allowOldDates : true
}, function(returnDate) {
var array = returnDate.split("/");
var day = array[2], month = array[1];
if (day <= 9)
day = "0" + day;
if (month <= 9)
month = "0" + month;
currentField.val(day + "/" + month + "/" + array[0]);
currentField.blur();
});