From the course: HTML & CSS: Creating Forms

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Number input type

Number input type - HTML Tutorial

From the course: HTML & CSS: Creating Forms

Start my 1-month free trial

Number input type

- [Instructor] If you need to collect numeric data, there are several input types that can be used. In this video, we'll look at the number input type, as well as attributes you can use to require users to enter data in a certain format. First is the number input type. This is used to collect either positive or negative numbers, including decimals. So, going to my page. On line 12, I'm going to enter an input type equals number, and then, for name, I'm just going to call this number and add the ID. Label for equals number. And number is what the user will see on the page. And then save and go to the browser, and there I have my field to enter a number. Now, I can enter numbers here. What's interesting, it won't let me enter anything that's not a digit, so right now, you can't see, but I'm typing letters but nothing is happening. It'll allow me to enter any digits, the plus or minus sign and the period for decimal point. So using this field is useful if you want to make sure that the…

Contents