01.
$(
'#<%=TextBoxXXX.ClientID%>'
).keyup(
function
(e) {
02.
clearTimeout($.data(
this
,
'timer'
));
03.
if
(e.keyCode == 13)
04.
search(
true
);
05.
else
06.
$(
this
).data(
'timer'
, setTimeout(search, 1500));
07.
});
08.
function
search(force) {
09.
var
existingString = $(
'#<%=TextBoxXXX.ClientID%>'
).val();
10.
if
(!force && existingString.length < 3)
return
;
11.
alert(
"Start search here."
);
12.
$(
'#<%=btnPostBack.ClientID%>'
).triger(
'click'
);
13.
14.
15.
16.
17.
}