入力月ステッププロパティ
例
法定月間隔を変更します。
document.getElementById("myMonth").step = "2";
定義と使用法
stepプロパティは、月フィールドのstep属性の値を設定または返します。
step属性は、ユーザーが月フィールドでカレンダーを開いたときに選択する有効な月間隔を指定します。
たとえば、step = "2"の場合、カレンダーで選択できるのは2か月ごと(1月、3月、5月など)のみです。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
step | Yes | Not supported | Not supported | Yes | Yes |
注: <input type = "month">要素は、Firefoxの日付フィールド/カレンダーを表示しません。
構文
stepプロパティを返します。
monthObject.step
stepプロパティを設定します。
monthObject.step = number
プロパティ値
Value | Description |
---|---|
number |
Specifies the legal month intervals. Default is 1 month. Examples: If step="2", you can only select every second month in the month calendar. If step="5", you can only select every fifth month in the month calendar. |
技術的な詳細
戻り値: | 法定月間隔を表す数値 |
---|
その他の例
例
法定月間隔を取得します。
var x = document.getElementById("myMonth").step;
関連ページ
HTMLリファレンス:HTML <input>ステップ属性
❮入力月オブジェクト