Please tell me difference

Hello, Campers!

Please explain what difference it may make In these two ways of defining submit button.

First way:

<button id="submit">Submit</button>

Second way:
<input type="submit" id="submit">

The first way is just a button with “submit” for its ID and the same text. It doesn’t do anything without further code to connect it to a form or other input.

On the other hand, the second way automatically makes said button the submit button for a form with no extra coding. All you have to do is put it inside a <form> tag.

You can read more about the second form here:
HTML input type=“submit”

Hope that helps!

1 Like