Is Button tag and attribute button going to work the same? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is Button tag and attribute button going to work the same?

✔For example: ✍<button>submit</button> ✍<input type="submit" value="submit">

16th Jan 2021, 10:46 PM
Mau'Kauba Nibabe
Mau'Kauba Nibabe - avatar
3 Answers
+ 1
Both <button type="submit"> and <input type="submit"> display as buttons and cause the form data to be submitted to the server. The difference is that <button> can have content, whereas <input> cannot (it is a null element). While the button-text of an <input> can be specified, you cannot add markup to the text or insert a picture. So <button> has a wider array of display options. Source: https://html.com/attributes/button-type/#:~:text=The%20difference%20is%20that%20%3Cbutton,text%20or%20insert%20a%20picture.
17th Jan 2021, 9:18 AM
Chris Coder
Chris Coder - avatar
+ 2
Thanks very much.
17th Jan 2021, 10:58 AM
Mau'Kauba Nibabe
Mau'Kauba Nibabe - avatar