HTMLInputElement: step 屬性
HTMLInputElement 介面的 step 屬性指示數字或日期時間 <input> 元素可以更改的步長。它反映了元素的 step 屬性。有效值包括字串 "any" 或包含正浮點數的字串。如果未顯式設定屬性,則 step 屬性為空字串。
值
一個表示元素 step 值或在未顯式設定任何步長時的空字串。
示例
js
const inputElement = document.querySelector('[type="number"]');
console.log(inputElement.step); // the current value of the step attribute
inputElement.step = 0.1; // sets the step value to "0.1"
inputElement.step = "any"; // sets the step to "any"
規範
| 規範 |
|---|
| HTML # dom-input-step |
瀏覽器相容性
載入中…