开发者

How can I pause jQuery until a condition is met?

The condition is that a SPACE is typed.... It's inside a CASE sta开发者_如何学JAVAtement:

        case KEY.ATSIGN:

                        clearTimeout(timeout);
                        //alert(event.keyCode);
                        while(event.keyCode != 32) {
                            alert(event.keyCode);
                            timeout = setTimeout(onChange, options.delayLong);

                        }

            break;

32 is the ascii for space... I am trying to get the subset matching feature to work in jQuery only AFTER an @ sign is typed.... Hence the case statement KEY.ATSIGN.


You can put an event handler on the keypress event on your input element and evaluate what key was pressed.

http://api.jquery.com/keypress/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜