Submit].">
Jquery method to determine whether the uploaded file with input type="file" is empty: use the html upload button, the code is [
The operating environment of this tutorial: windows7 system, jquery3.2.1 version, DELL G3 computer. This method is suitable for all brands of computers.
Recommended:jquery video tutorial
Jquery method to determine whether the uploaded file with input type="file" is empty:
If you want to get the input content of type="file"
, usevar file = $("id").val();
It will definitely not work. Here is the code:
html upload button is:
js code:
function submitXML(){ var fileInput = $('#reportXML').get(0).files[0]; console.info(fileInput); if(fileInput){ $("#reportXMLform").submit(); }else{ alert("请选择上传文件!"); } }
Related free learning recommendations:js video tutorial
The above is the detailed content of How does jquery determine whether the uploaded file with input type='file' is empty?. For more information, please follow other related articles on the PHP Chinese website!