| 修改日期 | 修改人 | 备注 |
| 2020-03-04 00:07:33[当前版本] | 朱凡 | 格式调整 |
| 2020-03-04 00:07:03 | 朱凡 | 创建版本 |
原创 FGstudy 最后发布于2019-10-01 17:25:13 阅读数 90 收藏
发布于2019-10-01 17:24:58
分类专栏: 随笔
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/FGstudy/article/details/101854125
展开
//测试keyup, keypress, keydown以及oninput四个事件的触发机制
<div class="wrapper">
<input id="input" type="text">
</div>
<script>
var input = document.getElementById("input");
input.addEventListener("keyup",function(){
console.log('event handle keyup');
});
input.addEventListener("keydown",function(){
console.log('event handle keydown');
});
input.addEventListener("keypress",function(){
console.log('event handle keypress');
});
input.addEventListener("input",function(){
console.log('event handle input');
});
</script>