Answers for "jQuery how to tell if file upload has been selected"

0

jQuery how to tell if file upload has been selected

// Using jQuery:
if ($('#upload-input-elem').get(0).files.length === 0) {
    console.log("No file selected.");
}
else
{
	console.log("File Selected");
}

// Using Pure JavaScript:
if( document.getElementById("upload-input-elem").files.length == 0 ){
    console.log("no files selected");
}
else
{
	console.log("File Selected");
}

// Happy coding, my homies <3
Posted by: Guest on March-11-2021

Code answers related to "jQuery how to tell if file upload has been selected"

Code answers related to "Javascript"

Browse Popular Code Answers by Language