網站首頁 編程語言 正文
jq監聽input type="file"發生改變,即選擇文件,并獲取文件名稱
<input id="fileupload" name="file" onchange="fileChange(event)" style="display: none" type="file"/>
function fileChange(e) {
console.log(e);
var e = e || window.event;
//獲取 文件 個數 取消的時候使用
var files = e.target.files;
if(files.length>0){
// 獲取文件名 并顯示文件名
var fileName = files[0].name;
$(".filename").text(fileName);
}else{
//清空文件名
$(".filename").text("");
}
}
原文鏈接:https://blog.csdn.net/zz975896590/article/details/119990839
相關推薦
- 2022-06-20 詳解Python列表解析式的使用方法_python
- 2022-05-11 什么是 Reactor 模式?
- 2023-07-02 Python基于歐拉角繪制一個立方體_python
- 2022-09-21 go?mod詳細使用教程_Golang
- 2022-10-19 react封裝Dialog彈框的方法_React
- 2022-07-13 卸載Kafka導致的broker id前后不一致,Zookeeper側清理殘留數據指導
- 2022-03-09 C++使用map實現多進程拷貝文件的程序思路_C 語言
- 2022-10-20 C++淺析虛函數使用方法_C 語言
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支