Input Week disabled attribute

Definition and Usage

disabled Attribute sets or returns whether the week field should be disabled.

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

This property reflects the HTML disabled attribute.

See also:

HTML Reference Manual:HTML <input> disabled Attribute

Example

Example 1

Disable the week field:

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

Try it yourself

Example 2

Check if the week field is disabled:

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

Try it yourself

Example 3

Disable and cancel the disable of the week field:

function disableBtn() {
    document.getElementById("myWeek").disabled = true;
}
function undisableBtn() {
    document.getElementById("myWeek").disabled = false;
}

Try it yourself

Syntax

Return the disabled attribute:

weekObject.disabled

Set the disabled attribute:

weekObject.disabled = true|false

Attribute value

Value Description
true|false

Determine whether the week field should be disabled.

  • true - The week field is disabled
  • false - Default. The week field is not disabled.

Technical Details

Return Value: Boolean value, if the week field is disabled, it returns true; otherwise return false.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="week"> element does not display any date field/calendar in Firefox.