Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript DOM Scripting By Example Adding and Removing Names Registering Names

Peter Retvari
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

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