Input Submit disabled attribute

Definition and Usage

disabled Set or return whether the submit button should be disabled.

Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.

See also:

HTML Reference Manual:HTML <input> disabled 属性

Example

Example 1

Disable the submit button:

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

Try it yourself

Example 2

Check if the submit button is disabled:

var x = document.getElementById("mySubmit").disabled;

Try it yourself

Syntax

Return disabled attribute:

submitObject.disabled

Set disabled attribute:

submitObject.disabled = true|false

属性值

描述
true|false

规定是否应禁用提交按钮。

  • true - 提交按钮被禁用
  • false - 默认。提交按钮未禁用

技术细节

返回值: 布尔值,如果提交按钮被禁用,则返回 true;否则返回 false

浏览器支持

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
支持 支持 支持 支持 支持