difference between input submit and button | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

difference between input submit and button

what is difference between <input type="submit" value="submit"> and <button type="submit>submit</button>

12th Aug 2017, 12:50 PM
Yuki Mirai Keiko
Yuki Mirai Keiko - avatar
8 Answers
+ 7
I think no difference
12th Aug 2017, 1:03 PM
Amethyst Animion
Amethyst Animion - avatar
+ 2
Ah, OK, I found the answer on Stack Overflow, if anyone's interested, maybe some people searching for this question in future :) https://stackoverflow.com/questions/7117639/input-type-submit-vs-button-tag-are-they-interchangeable Basically, some old version of IE (6/7) do not support <button>, but they are not that much in use anymore, and you can place alternative text if you think you will have users with those types of browsers. Otherwise, seems like <button></button> is recommended as more readable, and also it has an opening and closing tag, so you can nest in it other HTML elements like images, etc... So you have more options to customize it.
8th Dec 2018, 6:42 PM
bakitza
bakitza - avatar
+ 1
a button with a submit type will do it as well. Test it out.
12th Aug 2017, 2:52 PM
CHMD
CHMD - avatar
+ 1
Hmmmm...... more than a year later, I am asking myself the same question (thank you, search function!) :D In the SoloLearn HTML course they suggest <input type="submit"> and in FreeCodeCamp they suggest <button type="submit"></button>. I guess one of them could be legacy and the other a new version? Usually when there are two functions that seem to do exactly the same thing, there is always some slight difference, otherwise one would get deprecated. Maybe there's browser compatibility issues with one of them? I want to believe that it's just the same, but I am always suspicious that it's never exactly the same in how it works :D :D
8th Dec 2018, 6:20 PM
bakitza
bakitza - avatar
0
submit use when you want to send form in server to prossess (when you use asp.net,php) but button you can use it in javascript
12th Aug 2017, 1:51 PM
ASNM
ASNM - avatar
0
@ASNM you can manipulate the submit input type with JavaScript too. There's no big difference. In a form, a button with a submit type will behave similarly to an input type submit. A button without a submit type will do absolutely nothing. Both can be controlled by javascript
12th Aug 2017, 2:34 PM
CHMD
CHMD - avatar
0
when use submit and connect form in php will page reload but in button not
12th Aug 2017, 2:42 PM
ASNM
ASNM - avatar
0
i test it before 😊😊😊
12th Aug 2017, 2:54 PM
ASNM
ASNM - avatar