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

JavaScript DOM Scripting By Example Adding and Removing Names Registering Names

Peter Retvari
seal-mask
.a{fill-rule:evenodd;}techdegree
Peter Retvari
Full Stack JavaScript Techdegree Student 8,392 Points

Submit vs. Click event

Hi folks, could someone explain why is submit a better choice for forms? If I use submit instead of click event it will provide more information for the backend process?

I know from the teachers note, that submit is fired only on the form element, not the button or submit input. But why is better then click?

1 Answer

Diego ROJAS
Diego ROJAS
1,781 Points

Hi again,

Submit is great because it sends all the data into the URL which is one way.

It's great for google searches when you click the little search icon. For bigger chunks of data it's or sensitive info it's not recommended and other AJAX tools exist

Submit basically sends data to the server using the URL

If you're not going to be working in backend I don't think that'll be much use to you :D

Hope that helps

Happy coding