单击“取消”后如何清除输入文件?它适用于资源管理器,并且在chrome中无效

时间:2017-04-03 15:52:39

标签: javascript html google-chrome file-io clear

enter image description here

点击“取消”后,文件仍然卡在那里。 在资源管理器中它可以工作,但在chrome中我找不到任何方法来清除输入文件。 代码是: enter image description here 请任何帮助!!

这是我的代码:

var AddFileWindow = $('#AddFileWindow').kendoWindow({
    title: 'Add File',
    visible: false,
    modal: true,
    width: 440,
    height: 450,
    resizable: false,
    actions: [
        "Close"
    ],
    activate: function () {
        $('#AddFileWindow').show();
    },
    close: function (e) {
        clearAddFileWindow();
    }
}).data('kendoWindow');

    function clearAddFileWindow() {
         var fileInput = $('#frame-files');
         fileInput.replaceWith(fileInput.val(''));
         $("#machine-file").data("kendoDropDownList").select(0);
         $("#material-file").data("kendoDropDownList").select(0);

         document.getElementById("material-group").style.display = "none";
         document.getElementById("alert").style.display = "none";
         document.getElementById("Notes-file").value = ""; 
        }

    <div id="AddFileWindow" style="display:none;">
                <div class='k-edit-label'>
                    <div class="form-horizontal form-widgets col-sm-10" style="margin-left:15px;">
                        <div class="form-group">
                            <div class="fileinput fileinput-new input-group" data-provides="fileinput" style="margin-top:10px">
                                <div class="form-control"><i class="fa fa-file-text-o fileinput-exists"></i> <span class="fileinput-filename"></span></div>
                                <span class="input-group-addon btn btn-primary btn-file">
                                    <span class="fileinput-new">Select file</span><span class="fileinput-exists">Change</span>
                                    <input id="frame-files" style="height:70px" type="file" name="...">
                                </span>
                                <a href="#" class="input-group-addon btn btn-primary fileinput-exists" data-dismiss="fileinput">Remove</a>
                            </div>
                        </div>
                    </div>

0 个答案:

没有答案
相关问题