Any event triggered on autocomplete?

前端 未结 8 1984
余生分开走
余生分开走 2020-11-27 15:39

I have a pretty simple form. When the user types in an input field, I want to update what they\'ve typed somewhere else on the page. This all works fine. I\'ve bound the

8条回答
  •  庸人自扰
    2020-11-27 16:11

    I recommending using monitorEvents. It's a function provide by the javascript console in both web inspector and firebug that prints out all events that are generated by an element. Here's an example of how you'd use it:

    monitorEvents($("input")[0]);
    

    In your case, both Firefox and Opera generate an input event when the user selects an item from the autocomplete drop down. In IE7-8 a change event is produced after the user changes focus. The latest Chrome does generate a similar event.

    A detailed browser compatibility chart can be found here:
    https://developer.mozilla.org/en-US/docs/Web/Events/input

提交回复
热议问题