IE HTML 单选更改事件
我有一个项目需要一些值才能通过 HTML 单选更改事件使用 JavaScript 进行更新.
I have a project that requires some values to get updated with JavaScript from an HTML radio change event.
由于某种原因,在 IE 中,似乎直到收音机失去焦点后才会调用 onchange 事件.不幸的是,由于代码的设置方式,我不能使用 click 事件,必须使用 change 事件.
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.
有没有人知道一种方法可以强制 IE 在检查更改时而不是在失去焦点时引发更改事件?
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?
谢谢.
推荐答案
只需添加,可以通过onClick
事件强制IE触发onChange
事件,所以如果允许您使用 onClick
事件来触发更改事件,则应该这样做:
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();"/>
相关文章