[英]Is there a JS event that occurs when the user selects a file from a file field?
I would like to know if there is an event that I can call a JS function with that occurs when the user has selected a file for a file field. 我想知道是否有一个事件可以在用户为文件字段选择文件时调用JS函数。 Or is there something similar?
还是有类似的东西?
What I am trying to do is append the name of the file to the page once the user has selected the file, thanks. 我想做的是,一旦用户选择了文件,就将文件名追加到页面上。
when a user selects a file, the file input "changes", so you'll want to use the change
event. 当用户选择文件时,文件输入“ changes”,因此您将要使用
change
事件。
$("#myinput").on("change",function(){
console.log($(this).val());
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.