We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

概述

window对象上input事件的事件句柄,当<input> 元素的value属性值由输入设备改变时,就会触发input事件。

该事件是冒泡的,如果window对象支持该事件, <input>文本框元素同样也支持。

例子

<script>

window.addEventListener('input',function(e){
 console.log("检测到input事件!来自这个元素:", e.target);
}, false);

</script>

<input placeholder="在这里输入文字,并查看控制台">

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

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)

相关链接

规范

HTML - Common input elements APIs

文档标签和贡献者

此页面的贡献者: teoli, _Coin, khalid32, ziyunfei
最后编辑者: teoli,