开发者

jquery IE8 - using live('blur', function) and live('change',function) together

Ok, I have a weird problem with IE8 and jQuery. See the code below:

<!DOCTYPE html>
<html dir="ltr">
<head> 
</head>
<body>
<input>
<script type="text/javascript" language="javascript" src="jquery.tools.min.js"></script> 
<script type="text/javascript" language="javascript">
$(document).ready(function() {
        $('input').live('blur',function(){alert('blur');});
        $('input').live('change',function(){alert('change');});
});
</script>
</html>

With the code as is, I can't get the on change event handler to fire after editing the input field. However, if I comment out the 开发者_开发技巧blur event handler, then on change will fire.

Why does IE8 do this? What should I do to make both on blur and on change work simultaneously across all browsers?


jQuery tools includes the older v1.4.2 of jQuery. This seems to have a bug in IE8 that breaks your intended functionality. Upgrading to v1.6.1, then both events fire in IE8. I tested the older versions of jQuery and whatever was broken was fixed in v1.4.3 so if you cannot do a major version upgrade for whatever reason, then hopefully a minor version upgrade will be OK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜