开发者

Detecting if an input field has spawned an autosuggest list?

My problem: I have a keyup event attached to a field. If the previously typed autosuggest list开发者_StackOverflow appears and you select a value via the keyboard, the keyup event for the field fires. However, I do not want it to fire at this point.

Is it possible to detect if an input field has spawned a previously typed autosuggest list?

When I inspect the field via Firebug after the autosuggest list appears, I don't see a corresponding DOM element. I also do not know of any events associated with autosuggest lists.

Any help is mush appreciated. Thanks.


If you are talking about the browser built-in autosuggest form-fill feature, then no, there is no way to detect it, or interact with it via javascript.

You might be able to cancel it in some browsers via a event.prevetDefault(), tho to be honest i haven't tried it, and find it doubtful.

The feature is a convenience feature for the user, and should not concern website operators or developers - leave it alone, and your users will like you better ;)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜