监听textInput事件以获取其事件对象event,该事件的事件对象上有inputMethod属性,该属性有9个可能的值:
1 // 键盘输入
2 // 粘贴
3 // 拖入
4 // IME
5 // 表单中选取
6 // 手写输入
7 // 语音输入
8 // 多方法混合
9 // 脚本赋值
监听textInput事件以访问inputMethod属性,根据其值判断用户的输入手段,以下示例:
const ele = document.querySelector("#ele");
ele.addEventListener("textInput", (event) => {
console.log(event.inputMethod);
})












![[笔记]23年度展会信息— 吊钩 起升机构](https://img-blog.csdnimg.cn/dbf244da092849cab34fd0159e0fc75b.jpg)






