Javascript DOM HTML Input FileUpload Object get

Introduction

The Input FileUpload object represents an HTML <input> element with type="file".

We can access an <input> element with type="file" via document.getElementById():

var x = document.getElementById("myFile");

Click the "Test" button to disable the file upload button.

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="file" id="myFile">
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {// w  ww .  jav a  2s  .co m
  var x = document.getElementById("myFile");
  x.disabled = true;
}
</script>

</body>
</html>



PreviousNext

Related