Input Submit disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Submit

Description

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

Set the disabled property with the following Values

Value Description
true|false Sets whether a submit button should be disabled

Return Value

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

The following code shows how to disable a Submit button:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="submit" id="mySubmit">

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

<script>
function myFunction() {/*from  w ww.j a  v  a 2s  .c  om*/
    document.getElementById("mySubmit").disabled = true;
}
</script>

</body>
</html>

Related Tutorials