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 单选更改事件
基础教程推荐
- 检查 HTML5 拖放文件类型 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
