DOM Methods
HTMLInputElement.stepDown()
Decreases a supported numeric or date/time input by a number of allowed steps. The stepping algorithm uses the control's step rules and bounds. Unsupported types and step=any can throw. Programmatic stepping should not be assumed to dispatch user-input events. Example result: 2.
Formal Syntax & Structure
html syntaxhtml
element.stepDown(n)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| n | number | Optional integer number of steps, default 1. |
Return Value
undefined
No return value.
Working Example
Example Snippethtml
<input id="demo" type="number" min="0" step="2" value="6"><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; e.stepDown(2); result(e.valueAsNumber);</script>