I\'ve noticed in all of Bootstrap\'s examples using button
elements, they include role=\"button\"
(and type=\"button\"
), such as:
According to W3C Html5 Button
The missing value default is the Submit Button state.
If the type attribute is in the Submit Button state, the element is specifically a submit button.
Unless you're going to use buttons to submit a form, you need to explicitly set type="button"
as omitting this, as stated in W3C specification, it will act as a submit button, will submit your form. To avoid unnecessary submits, you need to explicitly set type="button"
to your s.
Since most of the bootstrap's buttons are for triggering a javascript function or similar behaviour, to avoid accidental unintentional submit behaviour upon code copy&paste and in the name of normalization with good practice, type="button"
and role="button"
attributes are added to