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

CSS CSS Selectors Selectors - Beyond the Basics DRY CSS

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

The difference between <input type="submit"> and <button type="submit">?

I had issues understanding why in the previous video we were styling elements that didn't exist on the page (respectively the button element) until I realized that <input type="submit" value="login"> it counts as a button.

In the "HTML forms" track (with Nick Pettit) I only saw this form

<button type="submit">Sign up</button>

IS there a real difference between them. Are they used in different circumstances? When do we use the input tag and when do we use the button tag? Thank you!

Christian Lawrence
Christian Lawrence
3,941 Points

My understanding of this is that the <button> tag is for on page interactions only e.g. postcode look up. Whereas, <input type="submit" value="login"> sends data but also moves the user to another screen e.g. my account.

2 Answers

Travis Alstrand
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Travis Alstrand
Treehouse Teacher

If anyone else is curious about this, I found this Stack Overflow page with a lot of handy info on this topic :smiley: here you go

Ben Schroeder
Ben Schroeder
22,818 Points

You can put HTML in a <button>, which is very handy for design.