0
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)
3 odpowiedzi
+ 1
<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.
0
Jamal I'm sorry, maybe I didn't explain it well.
I mean the difference between <button type="submit"> and <input type="submit"> 💁🏼♀️
0
<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.