Input Month defaultValue attribute

Definition and usage

defaultValue Set or return the default value of the month field.

Note:The default value is HTML value attribute specified in the value.

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 "More Examples").

If you want to check if the month/year of the month field has changed, the defaultValue attribute is very useful.

Instance

Example 1

Change the default value of the month field:

document.getElementById("myMonth").defaultValue = "2023-06";

Try it yourself

Example 2

Get the default value of the month field:

var x = document.getElementById("myMonth").defaultValue;

Try it yourself

Example 3

An example showing the difference between defaultValue and value attributes:

var x = document.getElementById("myMonth");
var defaultVal = x.defaultValue;
var currentVal = x.value;

Try it yourself

Syntax

Return defaultValue attribute:

monthObject.defaultValue

set defaultValue attribute:

monthObject.defaultValue = ویلوی

پرپرٹی کا مطلب

مقدار شرح
ویلوی مہینوں کے فیلڈ کی پیش داری کا شرط مقرر کیا گیا ہے۔

تکنیکی تفصیلات

بازگشت کا مطلب: صفتی مقدار، یہ میں کی جانب سے پیش کی گئی مقدار کا مطلب ہے۔

بھرپائی کا ذریعہ

کروم ایج فائرفاکس سافری آپرا
کروم ایج فائرفاکس سافری آپرا
پشتیبندی 10.0 پشتیبندی پشتیبندی پشتیبندی

توجہ:<input type="month"> عناصر میں فائرفاکس میں کوئی تاریخ کا فیلڈ/کالینڈر نہیں دکھایا جاتاً。