The disabled
property disables or enables a submit button.
disabled |
Yes | Yes | Yes | Yes | Yes |
Return the disabled property.
var v = submitObject.disabled
Set the disabled property.
submitObject.disabled=true|false
Value | Description |
---|---|
true|false | Disable or enable a submit button
|
A Boolean type value, true if the submit button is disabled, otherwise false.
The following code shows how to get if a Submit button is disabled.
<!DOCTYPE html>
<html>
<body>
<input type="submit" id="mySubmit" disabled>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--from w w w.j av a 2 s . c o m-->
var x = document.getElementById("mySubmit").disabled;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to disable a Submit button.
<!DOCTYPE html>
<html>
<body>
<!-- www. ja va 2 s . c om-->
<input type="submit" id="mySubmit">
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
document.getElementById("mySubmit").disabled = true;
}
</script>
</body>
</html>
The code above is rendered as follows: