Javascript DOM HTML Input Reset disabled Property set

Introduction

Disable a Reset button:

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

Click the button to disable the Reset button.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="reset" id="myReset">
<button onclick="myFunction()">Test</button>

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

</body>
</html>

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

This property mirrors the HTML disabled attribute.

The disabled property accepts and returns a boolean type value.

Value Description
true The reset button is disabled
false Default. The reset button is not disabled

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




PreviousNext

Related