Javascript DOM HTML Input FileUpload disabled Property set

Introduction

Disable a FileUpload button:

document.getElementById("myFile").disabled = true;

Click the button below to disable the FileUpload button above.

View in separate window

<!DOCTYPE html>
<html>
<body>

Get Image: <input type="file" id="myFile">
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//from  w  w  w  .j  a  v  a2s  .c  o  m
  document.getElementById("myFile").disabled = true;
}
</script>

</body>
</html>

The disabled property sets or gets whether a file upload button should be disabled.

This property mirrors the HTML disabled attribute.

The disabled property accepts and returns a boolean type value.

Property Values

Value Description
true The file upload button is disabled
false Default. The file upload button is not disabled

The disabled property returns true if the file upload button is disabled, otherwise it returns false.




PreviousNext

Related