Bootstrap 输入文件事件删除数据

Bootstrap input file event removing data

我正在使用 Bootstrap FileInput,它真的很棒 :)

我遇到了一些事件的问题。我想知道如何在提交文件后按下 "Remove" 按钮时检测到。这是我的意思的图片:

我使用了“fileremoved”、“filedeleted”、“filepredelete” , "filebeforedelete",...事件(关于 "remove" 或 "detele" 的任何事情),但它们不起作用。

我要找的活动是什么?我错过了什么吗?

谢谢!


编辑:

这是我为事件编写的小 JS 代码:

$('#file_upload').on('filebatchuploadcomplete', function() {
    console.log("I have pressed the upload button"); // --- Ok, it works!! :)
    // More stuff here...
});

$('#file_upload').on('fileremoved', function() {
    console.log("I have pressed the remove button"); // --- Never shown!! :(
    // More stuff here...
});

在Bootstrap FileInput最新版本中,删除事件是fileclearfilecleard (https://plugins.krajee.com/file-input/plugin-events#fileclear).

  • fileclear:当文件输入删除按钮或预览window关闭图标被按下以清除文件预览时触发此事件
  • filecleard:清除预览中的文件后触发此事件。

例如: $('#input-id').on('fileclear', function(event) { console.log("fileclear"); });