Input FileUpload disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input FileUpload

Description

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

This property reflects the HTML disabled attribute.

Set the disabled property with the following Values

Value Description
true|false Sets whether a file upload button should be disabled.
  • true - The file upload button is disabled
  • false - Default. The file upload button is not disabled

Return Value

A Boolean, returns true if the file upload button is disabled, otherwise it returns false

The following code shows how to disable a FileUpload button:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Get Image: <input type="file" id="myFile">

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*w ww  . ja va 2s.c  o m*/
    document.getElementById("myFile").disabled = true;
}
</script>

</body>
</html>

Related Tutorials