Languages
[Edit]
EN

HTML - set number input default value

0 points
Created by:
Wiktor-Sribiew
350

In this article, we would like to show you how to set number input default value in HTML.

Quick solution:

// ONLINE-RUNNER:browser;

<label>
  <span>Select the number:</span>
  <input type="number" name="input-name" value="0" />
</label>

 

Practical example

In this example, we use the input element's value attribute to set the input default value to 3.

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<body>
  <form>
    <label>
      <span>Select the number:</span>
      <input type="number" name="my-number" value="3" />
    </label>
  </form>
</body>
</html>

References

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join