简体   繁体   English

如何捕获输入的类型 = 'text' 清除事件?

[英]How to capture input's type = 'text' clear event?

<input type='text' onchange="reportAnswer(1, this.value);" onkeyup="this.onchange();" onpaste="this.onchange();" oncut="this.onchange();" onclear = "this.onchange();" />

在此处输入图片说明

How to capture that change?如何捕捉这种变化? This is IE11.这是IE11。

PS I added onclear handler because run out of ideas what to do. PS 我添加了onclear处理程序,因为没有想法该怎么做。

You haven't said what's providing that [x] , which is probably relevant, but the one event you haven't tried yet is input so: Live Example你还没有说是什么提供了[x] ,这可能是相关的,但是你还没有尝试过的一个事件是input这样的: Live Example

<input type='text'
    onchange="reportAnswer(1, this.value);"
    onkeyup="this.onchange();"
    onpaste="this.onchange();"
    oncut="this.onchange();"
    oninput="this.onchange();" />

(No idea if it works, IE11 doesn't add that box for me on Windows 8.1.) (不知道它是否有效,IE11 不会在 Windows 8.1 上为我添加该框。)

More likely, though, you need to hook into something provided by whatever it is that's providing that [x] .不过,更有可能的是,您需要挂钩提供[x]任何东西所提供的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM