Input Week readOnly Attribute

Definition and Usage

readOnly Set or return whether the week field should be read-only.

You cannot modify read-only fields. However, users can select, highlight it, and copy text from it.

This property reflects the HTML readonly attribute.

Tip:If you want to prevent users from interacting with the field, use disabled.

See Also:

HTML Reference Manual:HTML <input> readonly Attribute

Example

Example 1

Set the week field to read-only:

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

Try It Yourself

Example 2

Check if the week field is read-only:

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

Try It Yourself

Syntax

Return the readOnly attribute:

weekObject.readOnly

Set the readOnly attribute:

weekObject.readOnly = true|false

Attribute Value

Value Description
true|false

Specify whether the week field should be read-only.

  • true - The week field is read-only
  • false - Default. The week field is not read-only

Technical Details

Return value: Boolean value, if the week field is read-only, then return 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.