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 |
浏览器兼容性
加载中…