Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Frederico Graciano
Courses Plus Student 2,768 PointsWhat is the difference between <input type="button"/> and <button></button> ?
Well the title says everything that I'm asking.
What is the difference between the two above :
<input type="button" value="Submit">
<!--AND-->
<button type="submit" value="Submit">Submit</button>
When should I use it?
Should I avoid using one of them?
Thank you.
1 Answer
Christopher Loyd
Courses Plus Student 5,806 PointsThe main difference is that your input button is self-closing, and therefore you cannot add any other elements inside it. Since the button element is not self-closing, you can add other HTML within the button element - therefore creating more options for styling and such.
Additionally, you may be interested in the page below: