Good Morning,jQuery tự động hoàn toàn, sự kiện thay đổi không làm việc như mong đợi
Tôi có đoạn mã sau:
$("#close-request-field-clinic").autocomplete({
source: arrayClinic,
delay: 0,
minLength: 0,
isDivider: function(item) {
return false;
},
focus: function (event, ui) {
$('#close-request-field-clinic').val(ui.item.label);
return false;
},
select: function(event, ui) {
$('#close-request-field-clinic').val(ui.item.label);
if(ui.item.value == -1) {
resetField('#close-request-field-clinic', false);
} else {
successField('#close-request-field-clinic');
setKey(finalValues, 'clinic', ui.item.value);
if(msieversion()) {
$(this).blur();
}
}
checkValidation(fieldCheck,'#close-request-personal-information-next');
return false;
},
change: function(event, ui) {
alert('change');
if(!ui.item) {
resetField('#close-request-field-clinic', false);
removeKey(finalValues, 'clinic');
}
checkValidation(fieldCheck,'#close-request-personal-information-next');
return false;
}
}).focus(function(){$(this).autocomplete("search", "")});
Phần lớn các công trình này một cách hoàn hảo, tuy nhiên, có vẻ như rằng khi lĩnh vực này được thay đổi sự kiện 'thay đổi' không phải lúc nào cũng được kích hoạt.
Khi chọn phần tử từ danh sách, nó hoạt động tốt, tuy nhiên nếu bạn xóa các giá trị trong hộp bằng phím xóa (xóa), sau đó nhấp vào hộp văn bản, sự kiện thay đổi chỉ đôi khi được gọi là . Có điều gì tôi đang thiếu? .. Có vẻ như không chỉ được gọi khi các giá trị bị xóa theo cách thủ công.
Kính trọng, Josh
thể trùng lặp của [jQuery AutoComplete kích hoạt Thay đổi Event] (http://stackoverflow.com/question/6431459/jquery-autocomplete-trigger-change-event) – allicarn