Learn HTML by building a Cat Photo App Step 43

The task is Even though you added your button below the text input, they appear next to each other on the page. That’s because both input and button elements are inline elements, which don’t appear on new lines.

The button you added will submit the form by default. However, relying on default behavior may cause confusion. Add the type attribute with the value submit to the button to make it clear that it is a submit button.

I understand the solution, however what does it mean by default behaviour and why can it cause confusion. Will it cause possible contradictions in code down the line?

Welcome to the community!
I do not think it will cause a problem. However, it may cause confusion as to when the submit is required for a code.
I am certain a Moderator/Leader/Staff will provide more detail for you.
Happy coding! :slight_smile:

When its talking about default behavior it means when a button is inside a form without its type specified its going to submit the form. Thats just it means, without a type by default the button will submit a form.

However, if your button is outside a form and it does not have a type and you click on it it will do absolutely nothing.

Its also saying that if you rely on the default behavior which is not giving the button a type it can be confusing on what that button or buttons is actually supposed to be doing

Just keep in mind if you are going to use a button then you need to give it a type and you should be fine

2 Likes

Thank you.

I really appreciate it.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.