Input Week defaultValue attribute
Definition and usage
defaultValue
Sets or returns the default value of the week field.
Note:The default value is HTML value attribute defined by.
The difference between defaultValue and value attributes is that defaultValue contains the default value, while value contains the current value after some changes. If there is no change, defaultValue and value are the same (see the example below).
If you want to check if the week in the week field has changed, the defaultValue attribute is very useful.
Instance
Example 1
Change the default value of the week field:
document.getElementById("myWeek").defaultValue = "2023-W01";
Example 2
Get the default value of the week field:
var x = document.getElementById("myWeek").defaultValue;
Example 3
Show the example of difference between defaultValue and value attributes:
var x = document.getElementById("myWeek"); var defaultVal = x.defaultValue; var currentVal = x.value;
Syntax
Return defaultValue attribute:
weekObject.defaultValue
set defaultValue attribute:
weekObject.defaultValue = value
ਪ੍ਰਤੀਯੋਗ ਮੁੱਲ
ਮੁੱਲ | ਵਰਣਨ |
---|---|
value | ਹਫਤੇ ਦੇ ਮੁੱਢਲੇ ਮੁੱਲ ਨੂੰ ਨਿਰਧਾਰਿਤ ਕਰਦਾ ਹੈ。 |
ਤਕਨੀਕੀ ਵੇਰਵੇ
ਵਾਪਸ ਮੁੱਲ: | ਸਟਰਿੰਗ ਮੁੱਲ, ਜੋ ਮੁੱਢਲੀ ਹਫਤੇ ਦੀ ਮੁੱਲ ਨੂੰ ਦਰਸਾਉਂਦਾ ਹੈ。 |
---|
ਬਰਾਉਜ਼ਰ ਸਮਰਥਨ
ਚਰਮ | ਐਜ਼ | ਫਾਇਰਫਾਕਸ | ਸਫਾਰੀ | ਓਪੇਰਾ |
---|---|---|---|---|
ਚਰਮ | ਐਜ਼ | ਫਾਇਰਫਾਕਸ | ਸਫਾਰੀ | ਓਪੇਰਾ |
ਸਮਰਥਨ | 10.0 | ਸਮਰਥਨ | ਸਮਰਥਨ | ਸਮਰਥਨ |
ਧਿਆਨ:<input type="week"> ਐਲੀਮੈਂਟ ਫਾਇਰਫਾਕਸ ਵਿੱਚ ਕੋਈ ਮਿਤੀ ਫੀਲਡ/ਕੈਲੰਡਰ ਨਹੀਂ ਦਿਖਾਉਂਦਾ ਹੈ。