Javascript DOM HTML Input Submit disabled Property set

Introduction

Disable a Submit button:

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

Click the button to disable the Submit button.

View in separate window

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

<script>
function myFunction() {// w w  w .  j av a2s.  c om
  document.getElementById("mySubmit").disabled = true;
}
</script>

</body>
</html>

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

The disabled property accepts and returns a boolean type value.

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

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




PreviousNext

Related