问题描述
出于某种原因,在IE中,似乎onchange事件在电台失去焦点之前不会被调用。不幸的是,由于代码设置的方式,我无法使用click事件并必须使用change事件。
有没有人知道强制IE在检查发生变化时立即提出变更事件,而不是在失去焦点时提交变更事件?
谢谢。
只需添加,就可以使用 onClick $ c来强制IE触发
onChange
事件$ c>事件,所以如果允许使用 onClick
事件来触发更改事件,则应该这样做:
< input type =radioonclick =this.blur();/>
I have a project that requires some values to get updated with JavaScript from an HTML radio change event.
For some reason in IE, it seems that the onchange event isn't called until the radio has lost focus. Unfortunately due to the way the code is setup, I can't use the click event and have to use the change event.
Does anyone know of a way to force IE to raise the change event as soon as the check is changed rather than when it looses focus?
Thanks.
Just to add, you can force IE to trigger the onChange
event using the onClick
event, so if you are allowed use the onClick
event to trigger the change event, this should do it:
<input type="radio" onclick="this.blur();"/>
这篇关于IE HTML无线电改变事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!