簡體   English   中英

jQuery onchage無法在IE中使用文件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM