仅当元素失去焦点时才调用onChange [英] onChange is called only when the element loses focus

查看:78
本文介绍了仅当元素失去焦点时才调用onChange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望你在文本字段中输入div更改(我已经有了更改div的代码)。但是,onchange事件仅在完成后调用,并在文本字段外单击。我希望在输入每个字母时调用它。

I want that as you type in the textfield the div changes (I have the code for changing the div already). However the onchange event is only called once you are finished and click outside the textfield. I want it to be called as each letter is typed.

我的代码:

<input name="platetext" type="text" onchange="setValue(this)">


推荐答案

onChange onKeyUp 应该为你做的伎俩。

onChange is fired when the input looses focus I think. onKeyUp should do the trick for you.

这篇关于仅当元素失去焦点时才调用onChange的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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