捕获HTML文本输入键应用后按键? [英] Capturing HTML Text Input Key press after key has been applied?

查看:93
本文介绍了捕获HTML文本输入键应用后按键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个新手问题,请在这里与我联系;)

当在HTML文本输入控件中出现按键时,有两个事件看起来很有用管理它(onKeyPress和onChanged)。 onKeyPress在按下按键后但在操作应用于控件的文本之前触发。后者仅在焦点从控件中删除并进行编辑时才被解雇。



我的问题:有没有办法在按键按下后捕获事件应用于控件但不去除焦点(这样我就可以处理所产生的文本)?或者,这几乎是我必须处理的选项?



谢谢!

解决方案

您可能还想看看 onkeyup onkeydown 事件。我怀疑你对 onkeyup感兴趣。也许你可以提供更多信息,我可以举一个更完整的例子。


A total newbie question, so please bear with me here ;)

When a key press occurs in a HTML text input control, there are two events that seem useful in managing it (onKeyPress and onChanged). onKeyPress fires after the key has been pressed, but before the operation has been applied to the control's text. The later is only fired when focus is removed from the control and edits were made.

My question: Is there a way to capture the event, after the key press has been applied to the control but w/o removing focus (so I can work off of the resultant text)? Or is this pretty much the options I have to work off of?

Thanks!

解决方案

You may also want to look at onkeyup and onkeydown events. I suspect you're interested in onkeyup. Perhaps you could provide more info and I could give a more complete example.

这篇关于捕获HTML文本输入键应用后按键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆