Input FileUpload type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input FileUpload

Description

The type property returns which type of form element upload button.

For a file upload button, this property will always return "file".

Return Value

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:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials