Как восстановить значение размытия?Jquery

Программирование на jquery
Anonymous
Как восстановить значение размытия?

Сообщение Anonymous »

Я попробовал это:

Код: Выделить всё

$(function(){
$('.aComplete').each(function(){

var inputField = $(this);

$(this).autocomplete({
source   :"index.php?action=acomplete&name="+$(this).attr("name"),
minLength:1
})

//clear the input on click
.focus(function(){
if(inputField.val(undefined) != true){
temp = inputField.val();
inputField.val(undefined);
}
inputField.data("autocomplete").search(inputField.val());

//restore initial value if nothing was typed
}).blur(function(){
//check if field is empty and restore value from `temp` if so
alert(temp); //this shows empty string
});
});
});
Переменная temp становится пустой строкой, когда я вызываю ее при событии размытия. Почему это происходит и как это исправить?

Подробнее здесь: https://stackoverflow.com/questions/135 ... ue-on-blur

Вернуться в «Jquery»