oninput是否可以在Chrome中使用单选按钮? [英] Does oninput work in Chrome for radio buttons?
问题描述
有人知道 oninput
标签是否适用于Chrome中的单选按钮?这是我的代码:
Does anybody know if the oninput
tag works in Chrome for radio buttons? Here's my code:
<html>
<head><title>Weirdness</title></head>
<body>
<input type="number" min="1" size="2" oninput="window.alert(this.value);">
<input type="radio" name="myradio" value="A" oninput="window.alert(this.value);">
<input type="radio" name="myradio" value="B" oninput="window.alert(this.value);">
</body>
</html>
当我在Firefox中运行时, window.alert()当我更改其中一个输入时,code>调用完全正常。但是当我在Chrome上运行时,单选按钮在我选择单选按钮时不会调用该功能。尽管我发现所有规格都说Chrome支持
oninput
。或许我做错了什么?
When I run this in Firefox, the window.alert()
calls work perfectly fine when I change one of the inputs. But when I run this on Chrome, the radio button doesn't call the function when I select a radio button. This, despite all the specs I've found that say that Chrome supports oninput
. Or perhaps I'm doing something wrong?
谢谢。
推荐答案
如有疑问,您随时可以查看文档 。
You can always check the documentation when in doubt.
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 2 9 10 (Yes)
然而,根据生活标准,活动是......
However, according to the Living Standard, the event is...
当用户更改值时触发控件(另请参阅更改
事件)
Fired at controls when the user changes the value (see also the change event)
单击按钮或者复选框或单选按钮实际上并没有改变它的值,技术上可能不应该触发或依赖它来触发单选按钮。
Since clicking a button or checkbox or radio button doesn't actually change it's value, it technically probably shouldn't be triggered or relied upon to trigger on a radio button.
我可以确认它在Chrome 48中不起作用。
I can confirm it does not work in Chrome 48.
这篇关于oninput是否可以在Chrome中使用单选按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!