在input我看到这个jsfiddle之前,我从未听说过jQuery中的事件.
你知道它为什么有效吗?它是别名keyup还是什么?
$(document).on('input', 'input:text', function() {});
Run Code Online (Sandbox Code Playgroud) 有没有机会检测用户为input类型file元素的HTML所做的每个文件选择?
之前曾多次询问此问题,但onchange如果用户再次选择同一文件,则通常建议的事件不会触发.
我正在创建我的网站的上传按钮,但我无法触发基于当选择上传文件上的事件.我的印象是.submit函数做到了这一点,但我无法从中获得任何结果.HTML
<input type="button" id="uploadbutton" value="Upload File" />
<form action="includes/uploader.php" method="POST" id="fileupload_form">
<input id="fileupload" type="file" name="files[]" multiple style="display:none;">
<input id="server" type="hidden" name="server" value="upload">
<input type="hidden" id="storeA" value="statement_upload" name="storeA">
</form>
Run Code Online (Sandbox Code Playgroud)
使用Javascript/jQuery的
var fileupload = $("#fileupload");
$("#uploadbutton").click( function(){
fileupload.click();
});
$("#fileupload_form").submit( function(e){}
Run Code Online (Sandbox Code Playgroud)
尝试选择文件时不会运行此javascript函数,也不会给出错误.任何和所有的帮助表示赞赏!
I have html:
<form id="fileuploadform">
<input type="file" id="fileupload" name="fileupload" />
</form>
Run Code Online (Sandbox Code Playgroud)
and jquery:
$(':file').change(function(){
var file = this.files[0];
...
});
Run Code Online (Sandbox Code Playgroud)
The problem is: the change function fires only when the file selection is different than the selection made previously. That is of course the meaning of the 'change' event. I want my function to be called with the file dialog closes, no matter what.
我尝试使用 'select' 事件——它永远不会被调用
我也试过:
$(':file').bind('dialogclose', function(event) {
alert('closed');
});
Run Code Online (Sandbox Code Playgroud)
和:
$(':file').live("dialogclose", function(){
alert('closed1');
});
Run Code Online (Sandbox Code Playgroud)
他们也没有工作。
这是我上传excel文件的html代码
<span class="control-fileupload" >
<label for="file1" class="text-left">{{filePlaceHolder}}</label>
<input type="file" id="file1" value="" (change)="openFile($event)" >
</span>
Run Code Online (Sandbox Code Playgroud)
但问题是,如果我上传两次相同的文件,则更改功能不会再次执行,因为输入字段没有变化.
假设我已经上传了一次abc.xls文件,并且对此文件进行了一些验证,如果我更改了abc.xls的内容并重新上传它,那么更改函数不再重新验证它.
每次上传文件时我应该对工作更改功能做出哪些更改,无论文件名是否相同.
我想知道如何在类型脚本中编写此单击函数,因为我是新手.
我在 HTML 中有以下行:
<input type="file" #fileInput style="display: none" accept=".xml" (change)="OnFileSelected($event)"/>Run Code Online (Sandbox Code Playgroud)
选择文件后,将调用 OnFileSelected 回调。但是,如果我再次选择同一个文件,则不会调用此回调。
你能帮忙吗?
我们如何在Vue Js中通过文件输入检测SAME文件输入的变化
<input ref="imageUploader" type="file" @change="uploadImageFile">
可以使用事件检查输入是否未更改change()?
我正在使用<input type='file' />,我想警告用户他自己的行为没有变化.
现在,我刚刚做了一个正常的change()事件:
// fire the thumbnail (img preview)
$("#file-input").on("change", function () {
readURL(this); // create the thumbnail
});
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
Prev Solutuib:
好吧,我找到了一个解决方法,真正的问题是我给用户一个选项来隐藏缩略图,如果他想要,再打开......
但缩略图只会在用户选择图像时打开,这就是问题,因为更改事件会触发此选项打开,因此,如果没有更改,则不会打开缩略图.
所以,当我隐藏缩略图时,我会更改input file 为新的缩略图,使更改事件始终触发.
javascript ×5
html ×4
jquery ×3
input ×2
angular ×1
callback ×1
dom-events ×1
events ×1
file ×1
file-upload ×1
forms ×1
onchange ×1
thumbnails ×1
vue.js ×1
vuejs2 ×1
vuetify.js ×1