概述
window对象上input事件的事件句柄,当<input>
元素的value属性值由输入设备改变时,就会触发input事件。
该事件是冒泡的,如果window对象支持该事件, <input>
文本框元素同样也支持。
例子
<script> window.addEventListener('input',function(e){ console.log("检测到input事件!来自这个元素:", e.target); }, false); </script> <input placeholder="disabled">
浏览器兼容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | 2 | 9 | 10 | (Yes) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | ? | ? | ? | (Yes) |
相关链接
- A HTML5 Browser maze, oninput support
- Fixing oninput in IE Using html5Widgets includes polyfill for IE6-8
- Mathias Bynens suggests binding to both input and keydown
- oninput event | dottoro has notes about bugginess in IE9