html change 事件

时间:2015-05-08 11:12:02   收藏:0   阅读:1764

The change event is fired for <input><select>, and <textarea> elements when a change to the element‘s value is committed by the user. Unlike the inputevent, the change event is not necessarily fired for each change to an element‘s value.

事件在元素input,select,textarea的内容由用户改变的时候触发,并且不像input事件每一次的改变都触发。

Description

Depending on the kind of form element being changed and the way the user interacts with the element, the change event fires at a different moment:

Different browsers do not always agree whether a change event should be fired for certain types of interaction. For example, keyboard navigation in <select>elements never fires a change event in Gecko until the user hits Enter or switches the focus away from the <select> (see bug 126379).

描述

事件触发依赖于元素类型,触发方式以及触发不同时刻,如下所示

不同的游览器不保证特定类型的交互触发change事件。例如,在Gecko,除非用户点击enter或者从<select>移去焦点,通过键盘选取select将不会触发change事件。


引用:https://developer.mozilla.org/en-US/docs/Web/Events/change


**

怪不得很多change事件和预想的不一样。

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!