I am trying to do something like this
case KEY.ATSIGN:
while(!KEY.SPACE) {
clearTimeout(timeout);
timeout = setTimeout(onChange, options.delayLong);
}
break;
ATSIGN = 50 which is the ascii code for the @.. This invokes the autocomplete dropdown.
SPACE = 32 which is the ascii for the space character.
I need it to dropdown the autocomplete AND allow subset searching or matchCont开发者_C百科ains searching up until a space character is entered. Is this possible?
is your code like this?
switch(e.which){
case KEY.ATSIGN : while(!KEY.SPACE){...}
}
if it is, then its wrong. when ever keypressed happen its like while(true).
try this
switch(e.which){
case KEY.SPACE: onChange();
}
i'm not quite understand. but try this.
<input type='text' /><select>...</select>
...
$("input").keydown(function(e){
switch(e.which){
case KEY.ATSIGN : $(this).keyup(doSomething);
case KEY.SPACE : $(this).unbind("keyup");
}
})
function doSomething(){...}
Try this Facebook like Autosuggestion with jQuery, Ajax and PHP.
精彩评论