Closed
Description
Please describe what the rule should do:
All <button>
tags require the type to be set.
What category should the rule belong to?
- Enforces code style
- Warns about a potential error
- Suggests an alternate way of doing something
- Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
<button>Test</button>
<button class="btn btn-danger">Delete</button>
Additional context
Forgetting the type
attribute on a button defaults it to being a submit type. This is nearly never what is intended, especially in your average one-page application.
type="button"
stops the webpage from submitting the form, instead allowing the @click
handler to work without the page reloading soon after.
type="submit"
can be used explicitly to allow the default behaviour.
Metadata
Metadata
Assignees
Labels
No labels