Button HTML error
parveson opened this issue · 3 comments
MDN URL
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
What specific section or headline is this issue about?
First example on this page has an error
What information was incorrect, unhelpful, or incomplete?
The button HTML as written does not work. It should say class="styled". Instead it says class="favorite styled".
What did you expect to see?
The form should submit and show a result. It does not.
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
- Folder:
en-us/web/html/element/button
- MDN URL: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/html/element/button/index.md
- Last commit: mdn/content@e0d9225
- Document last modified: 2023-07-03T09:21:02.000Z
It looks like this is your first issue. Welcome! 👋 One of the project maintainers will be with you as soon as possible. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct.
The button is purposefully not connected to a form because that's not the intention of this example. Buttons serve thousands of use cases and submitting a form is just one of them. The button here purely shows its "clickable" nature without any script logic.
The extra class seems harmless to remove, but it shouldn't break anything either.
The class
attribute takes a space-separated list of class names as its value. While the "favorites" class has no associated CSS styles, the attribute as written is valid, though more verbose than needed.
Closing, as the class attribute value is not an issue.
if you are arguing that one of the three button examples on the page should actually have an action attached, please re-open with a comment or submit a new issue.