Product Landing Page help for submit button

Tell us what’s happening:

I need to make the email address required…nothing happens when I click submit. Ideally I should get an error message saying email address required if I don’t enter one?

Help appreciated!
Your code so far

Get Started

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:

Did you add the ‘required’ attribute to your email input? You didn’t share your code so we can’t see what’s missing.

Here’s the appropriate HTML5 lesson that demonstrates the use of the ‘required’ keyword.

1 Like


Can you post a link to a codepen? Someone will probably spot the problem.

I wonder if it is the button or the input field that are failing you?

Did you include the required attribute on that input tag?

Are both the email input and your submit button nested inside the form tags?

Sorry, here is the codepen link!:

Yes I have put the required attribute in, here is my code:

You have some duplicate id attributes in that form. id must be (should be) unique. Look at the requirements to make sure you are using the specified id on each tag. Because of this your submit button has the wrong form= attribute. The form attribute on your submit button tag must match the id of the form.

You could use input type="submit" instead of button to avoid the need for a form attribute.

Also, I don’t believe that required is an attribute of the form tag - just input fields.

Fix those form and id attributes and validation should work as expected.

I have amended my code as below and it now works:

thank you so much for your help! :slight_smile: