FAQ: Learn HTML: Forms - Number Input

step defines how much should it jump once you decrease or increase it, so if step is 2 then when I click up it will be incremented by 2

Hope this helps :grinning:


I’ve noticed that the instructions mention name but not id, however to pass the code you need to have both.

1 Like

Use name attributes for form controls, as that’s the identifier used in the POST or GET call that happens on form submission.
Use id attributes whenever you need to address a particular HTML element with CSS, JavaScript or a fragment identifier.
It’s possible to look up elements by name too, but it’s simpler and more reliable to look them up by ID.
Name is used for form handling in PHP when a form is submitted via HTML, name doesn’t have to be unique on a page, as it can link other elements together.

Hope this helps :grinning:


how do i remove the arrows inside the textbox for a number type? or does it automatically appear for every number box


Here’s a question on stackoverflow that is the same as yours:

1 Like

I still don’t get it.
Why is the id attribute to identify the element in CSS/JS even though in the lesson whe saw that it’s related to the attribute “for” in the label element (which is html language or I am wrong?)?
Sorry for my bad english!

1 Like

Id is used in CSS and in JS as you said:

document.getElementById("someId") // javascript

#someId {
  color: green; /* CSS */

For is used for labeling as you said, and name too.

But beacuse Id-s are unique it’s easier to handle them in JavaScript.
So that name’s aren’t unique they return an array even if there is only one name, just like classes:

document.getElementsByName("someName") // Names

document.getElementsByClassName("someClass") // Classes

As I said they return an array so we target one of them with:

document.getElementsByName("someName")[0] // Names

document.getElementsByClassName("someClass")[0] // Classes

We can even target all of them (or some of them) with a for loop:

for (let i = 0; i < document.getElementsByClassName.length; i++) {
  document.getElementsByClassName[i].style.color = "green";

And we use names to work with forms in PHP.

Hope this helps :grinning:

1 Like

When using the type=“text’” attribute we used the value attribute. But i don’t see it being used when using the type=“number” atrribute. Why so?

1 Like

type has nothing to do with value, of course I mean that type will change how (for example password) and what can be written there (for example number) but there aren’t any links between these like when using for and name.

Value was only needed to set there to provide the “customer” an example that can be written there.

Hope this helps :grinning:
(And I’m really sorry for the late reply but I got busy)

Why i can not use head /head instead section tag?

1 Like

Because you want the contents of the <section></section> element to be displayed on the web page. See this article regarding the purpose of the <head></head> tag:

Hope this helps!


in my exercise says:

section(tag) class(attribute)=“cheesy”

and do not appear on display, so far i haven’t work with Section(tag), and what the purpose of it.



I can’t seem to move past the Number Input section. What is wrong with this code?

    <section class="patties">
      <label for="amount">How many patties would you like?</label>
				<input id="amount" name="amount" type="number" step="1">
1 Like

Your code appears fine. You might try refreshing your browser.

1 Like

bro you have to associate the to with the help of #id your answer was wrong because you didn’t type the correct id as you mentioned in label was number but what you mentioned in was amount…
hope this will help you

maybe bcz the attributes in are not in the correct order according to codeacademy
the correct order is ;

but when you will use a ide as such as dreamweaver etc it doesn’t, matter it is just an issue with code academy itself, maybe you would have noticed it in the

part where


was correct but

paragraph was not

hope this will help you …
“your code is absolutely correct as far as i know”

they must have thaught of it as unnecessary, the motive for them to use value attribute was to make sure that we also know about that""""
hope my answer helps you correct me if i’m wrong!!!

This question has been asked many times in this HTML Forms unit, and the best answer I’ve seen so far is this: FAQ: Learn HTML: Forms - Adding a Label


Just wondering if “name” and “id” must be passed to the same string. Can anyone help with this?

after i create a form in which i allow the user to fill a number as input how do i restrict his access to scroll till non negative numbers (because the number of burgers=-2 doesn’t make any sense)
PS:found the answer to this question the next exercise “Range input”