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


Gregor Šebela
Gregor Šebela
11,236 Points

$('form').submit(function (evt) - Why is 'evt' parameter needed?


Can someone explain why is evt parameter needed and what kind of value does it contain when form is submitted.


1 Answer

Dan Weru
Dan Weru
47,649 Points

The evt argument enables you to hook into form functionality and information . It doesn't have to be named evt ... You can name it however you please. For example, you could write

   e.preventDefault(); // prevent default behaviour 
   // validate form
   // submit form info via ajax 

Look into this [stackoverflow question](https://stackoverflow.com/questions/35936365/javascript-what-exactly-is-parameter-eevent-and-why-pass-it-to-javascript-fun) for a more info.