HTML | DOM Input FileUpload type Property
Last Updated :
29 Aug, 2022
The Input FileUpload type Property is used in HTML DOM to return the type of form element the file upload button is. This property will always return “file” for a file upload button.
Syntax:
fileuploadObject.type
Return Value: It returns a string value that represents the type of form element the file upload button is.
Examples:
HTML
<!DOCTYPE html>
< html >
< head >
< style >
h1 {
color: green;
}
</ style >
</ head >
< body >
< center >
< h1 >
Geeks for Geeks
</ h1 >
< input type = "file"
id = "myFile"
required>
< p id = "demo" ></ p >
< button onclick = "myFunction()" >
Click
</ button >
< script >
function myFunction() {
var x =
document.getElementById(
"myFile").type;
document.getElementById(
"demo").innerHTML = x;
}
</ script >
</ center >
</ body >
</ html >
|
Output:
Before:
After:
Supported Browsers:
- Google Chrome 1+
- Mozilla Firefox 1+
- Edge 12+
- Opera 11+
- Apple Safari 1+
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...