Input submit Vs Button submit tags? 🤷🏼‍♀️ | Sololearn: Learn to code for FREE!


Input submit Vs Button submit tags? 🤷🏼‍♀️

Usually when I see some php tutorials or github repositories they use the input tag with the "submit" type instead a button. Why they use it? Which one is better? And why? (When I change the input tag for a button I get the same result so that's where my doubt has borned)

4/11/2021 6:20:55 PM

Ariadne Rangel

3 Answers

New Answer


<input type="button" /> buttons will not submit a form - they don't do anything by default. They're generally used in conjunction with JavaScript as part of an AJAX application. <input type="submit"> buttons will submit the form they are in when the user clicks on them, unless you specify otherwise with JavaScript.


Jamal I'm sorry, maybe I didn't explain it well. I mean the difference between <button type="submit"> and <input type="submit"> 💁🏼‍♀️


<button> allows content within, <input> does not. <button> by default acts as submitter when placed within a <form>. Adding attribute `type = "button"` changes the default behaviour.