Do I need to specify type="submit" on submit buttons?

Viewed 514

Previously, when I've had a form with a single submit button on it, I've usually not put the type="submit" attribute in there. I've never observed this causing problems, and had believed that "submit" was the default type for a button and that I could rely on this behaviour.

However, w3schools and MDN disagree on whether I am right.

w3schools claims:

Tip: Always specify the type attribute for the <button> element. Different browsers may use different default types for the <button> element.

whereas MDN claims:

  • submit: ... This is the default if the attribute is not specified, or if the attribute is dynamically changed to an empty or invalid value.

Who is right and who is wrong - both according to spec, and in real browsers?

1 Answers
Related