0

我正在尝试使用 datepicker phonegap-plugin-android( datepickerPlugin )。它有效,但是当我从第 2 次开始单击文本框时出现问题,日期选择器显示 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();
        });
4

0 回答 0