【问题标题】:change event not firing in IE for the first time第一次在 IE 中未触发更改事件
【发布时间】:2017-05-31 08:32:56
【问题描述】:
$(this).find('.custom-file-input').trigger('click');
$(this).find(".custom-file-input").off().on('change', function (){
....
}

上面是我的代码 sn-p,我试图触发文件上传输入的点击,这会打开文件打开对话框,然后在更改时,我正在尝试执行一些代码。在IE中,第一次,它不起作用。

在 chrome 和 firefox 中,它每次都能成功运行。

【问题讨论】:

  • 控制台是否显示任何错误?
  • 您是否尝试过颠倒顺序 - 在触发点击事件之前先绑定更改处理程序? (那么 .off() 有什么用处?)
  • @CBroe,它成功了,谢谢。

标签: javascript jquery internet-explorer file-upload


【解决方案1】:

您是否尝试更改订单?

$(this).find(".custom-file-input").on('change', function (){
....
}
$(this).find('.custom-file-input').trigger('click');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-17
    • 1970-01-01
    • 2015-12-05
    • 2012-10-22
    • 1970-01-01
    • 2010-12-10
    • 1970-01-01
    相关资源
    最近更新 更多