Input Week readOnlyProperty

Input Week 对象参考手册Input Week Object

Example

Set the week field to read-only:

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

Output:


Try it yourself »

Definition and Usage

The readOnly property is used to set or return whether the week field is read-only.

A read-only field cannot be modified. However, the content of the field can be copied.

This property reflects the HTML readonly attribute.

Tip:To ensure the accuracy of form data, you can usedisabledthe property instead.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the readOnly property.

Note:Internet Explorer or Firefox browsers do not support the <input type="week"> element.


Syntax

Return the readOnly property:

weekObject.readOnly

Set the readOnly property:

weekObject.readOnly=true|false

Property Values

Value Description
true|false Describes whether the week field is read-only
  • true - The week field is read-only
  • false - Default. The week field is not read-only

Technical Details

Return Value: A Boolean, returns true if the week field is read-only, otherwise returns false.


More Examples

Example

Check whether the week field is read-only:

var x = document.getElementById("myWeek").readOnly;
xThe output result is:
true

Try it yourself »


Related Pages

HTML Reference:HTML <input> readonly attribute


Input Week 对象参考手册Input Week Object Other Extensions