[英]jQuery onchage not working in IE with file
这是我的示例代码,我想通过Ajax上传文件,但是在IE中,当我单击浏览器时它不起作用,否则它将正常工作吗?
$(document).ready(function() {
$('#photoimg').live('change', function() {
// $("#photoimg").bind('propertychange change', function(e) {
$(this).blur();
$("#thumbnail").html('');
$("#thumbnail").html('<img src="assets_admin/images/loader.gif">');
$("#imageform").ajaxForm({
target: '#thumbnail'
}).submit();
//setTimeout ("empty_image()",10000);
});
});
$ .live()不支持change事件:
当前不支持:模糊,焦点,mouseenter,mouseleave,更改,提交http://docs.jquery.com/Events/live
使用委托代替live。
$('div.facet_dropdown select').delegate('change', function() { ... });
实际上,IE,尤其是IE7 / 8并不很好地支持onchange事件。 我建议您使用onclick事件。
根据MSDN,onchange事件不会在IE中冒泡。
Scott Leberknight的onChange http://www.nofluffjuststuff.com/blog/scott_leberknight/2005/04/onclick_versus_onchange_in_ie_and_firefox
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.