Javascript examples for DOM HTML Element:Input FileUpload
The type property returns which type of form element upload button.
For a file upload button, this property will always return "file".
Type | Description |
---|---|
String | The type of form element the file upload button is |
The following code shows how to check which type of form element the file upload button is:
<!DOCTYPE html> <html> <body> Select a file to upload: <input type="file" id="myFile"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . ja v a 2 s . c o m*/ var x = document.getElementById("myFile").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>