简体   繁体   English

使用JavaScript(jQuery)的IE(IE9及更低版本)上的怪异问题

[英]Weird issue on IE (IE9 and lower) with JavaScript (jQuery)

I am experiencing a weird problem on IE (IE 9 and lower). 我在IE(IE 9及更低版本)上遇到一个奇怪的问题。

I have a form having a select and a radio. 我有一个带有选择和收音机的表格。 When anyone changes anything in the select or radio, it calculates the total price. 当任何人更改选择或收音机中的任何内容时,它将计算总价格。

Here is the code: http://jsfiddle.net/Debiprasad/DLQ82/8/ 这是代码: http : //jsfiddle.net/Debiprasad/DLQ82/8/

It works fine in all browsers. 在所有浏览器中都可以正常工作。 But when I am testing this on IE: When I am changing the select value, then it works fine. 但是,当我在IE上对此进行测试时:当我更改选择值时,它可以正常工作。 But when I am changing the value radio, then it does not work. 但是,当我更改价值广播时,它不起作用。

The weird part is, if I added an alert to any of the functions, which executed when the value of radio changes, then it works fine on IE. 奇怪的是,如果我向任何功能添加了警报,这些警报在无线电值更改时执行,那么它在IE上可以正常工作。 What could be the problem and how to fix this? 可能是什么问题,以及如何解决?

In IE, the change event on radio and checkbox controls only fires when the element loses focus , unlike other browsers. 在IE中,单选按钮和复选框控件上的change事件仅在元素失去焦点时才触发,这与其他浏览器不同。

I think jQuery fixed their change event to use propertychange in IE some time ago, you can see this by changing the jQuery version in jsFiddle to 1.3.2 and observing the different behaviour. 我认为jQuery不久前修复了他们的change事件以在IE中使用propertychange ,您可以通过将jsFiddle中的jQuery版本更改为1.3.2并观察不同的行为来看到这一点。 Which version of jQuery are you using locally? 您在本地使用哪个版本的jQuery?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM