IE HTML radio change event(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();"/>
这篇关于IE HTML 单选更改事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:IE HTML 单选更改事件


- addEventListener 在 IE 11 中不起作用 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01