What’s the difference between type=” submit ” and type=” button ”? in Html
Apr 15, 2022
You have probably seen these three interchangeable codes below. Probably asking yourself, when should I use which? Then say, ‘Ugh watevs.., I will just add another cup of coffee or tea.’
<button type="button">Submit</button>
or
<button type="submit">Submit</button>
or even
<label for="submit">Submit</label>
<input type="submit" id="submit">
It’s to do with the ‘default’ activity of type="submit"
. Tags with the type submit will submit a form to the server by default. While the Html tags without that type will submit the form with an extra code.