+ 13
What is the different between <button> and button attribute input?
<button>click</button> <Input type="button" value="submit">
4 odpowiedzi
+ 9
The difference is very subtle for your browser, but it's out there. You can use them interchangeably for your advantage in code. For example, to make a single <button> stand out from the "crowd" of other input types.
However <button> tags are containers, hence technically they can contain other HTML elements. Keep in my mind, that the text inside the button can be highlighted with a long tap. Beware of that, when making some kind of action game, because a long tap can completely disable your button. Then you gonna need some boiler plate code to avoid it, or simply use <input> tags.
Changing of the caption is obviously a bit different. When you make a "Play/Pause" button using an <input> tag, you'd change the value attribute. With a <button> tag — textContent... Or innerHTML 😀.
+ 9
You can find some of that boiler plate code in the answers to one of my old question 👇:
https://www.sololearn.com/Discuss/2351784/?ref=app
+ 5
Hmm you can use the button tag inside a form tag with type submit.
And on the other hand you could change type from the input tag with Javascript. I don't know if that make sense.
So the different is they have different attributes.
+ 3
🤔