FAQ: Learn HTML: Form Validation - Requiring an Input

This community-built FAQ covers the “Requiring an Input” exercise from the lesson “Learn HTML: Form Validation”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Introduction to HTML

FAQs on the exercise Requiring an Input

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

It’s already filled in for me.

Already filed required attribute

How can I style the text error box that pops up after nothing has been entered in the input box.

what is the use of class atrribute

I don’t know much about HTML 5 but I’m pretty sure it comes into play when you start including Javascript code into a website. Sorry if this answer isn’t very informative, that’s about as far as I know.

See this lesson from CodeCademy: https://www.codecademy.com/courses/learn-css/lessons/css-setup-selectors/exercises/class-name

Hi, I was wondering how I use the required attribute in case I have put in a radio button input, checkbox input, dropdownlist, datalist input etc. Because there are a variety of inputs there.

Thanks in advance.

3 Likes

Hi,
How do we change the text of the validation message popup?
where did it fetch the popup content from as we didn’t enter it as part of the HTML code.

1 Like

Does it matter if the “label element” or the “input element” comes first in writing code? Is their a hierarchy? I keep seeing them interchanged in hierarchical structure. But I also see the “
” tag used too between the 2 elements, and I am wandering if that affects where text is displayed in the output if hierarchy does/doesn’t matter between the 2 elements?

The input box field of this exercise has arrows in it as if the attribute step had been used, but i do not see it in the code and I don’t understand how it shows up. Am I misunderstanding how the arrows are applied to an input? I’ve copied the below:

<form action="check.html" method="GET">
       <label for="guess">Enter a number between 1-10:</label>
       <br>
       <!--Add the min and max attribute to the input-->
       <input type="number" name="guess" id="guess" required min="1" max="10">
       <br>
       <input type="submit" id="submission" value="Submit">
     </form>

Where do you find the code that tells you the answer is 3?