Javascript DOM HTML Input FileUpload disable and enable

Introduction

Disable and enable a FileUpload button:

View in separate window

<!DOCTYPE html>
<html>
<body>

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

<button onclick="disableBtn()">Disable File Upload</button>
<button onclick="enableBtn()">enable File Upload</button>

<script>
function disableBtn() {/*from   w  w w  . j a v a  2 s .co m*/
  document.getElementById("myFile").disabled = true;
}

function enableBtn() {
  document.getElementById("myFile").disabled = false;
}
</script>

</body>
</html>



PreviousNext

Related