简体   繁体   中英

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

I am experiencing a weird problem on IE (IE 9 and lower).

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/

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. 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. 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.

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. Which version of jQuery are you using locally?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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