扫码关注官方订阅号
原生JS如何判断 input type='file' 为空,也就是判断用户是否选择了文件
业精于勤,荒于嬉;行成于思,毁于随。
var oInput = document.getElementById('fileInput'); oInput.onchange = function() { if(this.value == '') { alert('empty'); }else { alert(this.value); } }
document.querySelector("input[type=file]").value这样?
document.querySelector("input[type=file]").value
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
document.querySelector("input[type=file]").value
这样?