How do I check whether a checkbox is checked in jQuery? When you fill in the details and select the submit button, the natural behavior is for the data to be submitted to a specified page on the server for processing, and the browser to be redirected to a "success message" page of some kind (or the same page, if another is not specified.). It works like this: Old thread, but for search purposes; try: ... and check out the "data" parameter: Nesting functions inside anonymous functions is not a good idea as you can't unbind the anonymous function easily. The third parameter is a boolean value specifying whether to use event bubbling or event capturing. Making statements based on opinion; back them up with references or personal experience. Second, you can register multiple handlers for the same listener. Note the differences from this (=event.currentTarget):. We then select all of them using document.querySelectorAll(), then loop through each one, adding an onclick handler to each that makes it so that a random color is applied to each one when selected: The output is as follows (try clicking around on it — have fun): Most event handlers you'll encounter have a standard set of properties and functions (methods) available on the event object; see the Event object reference for a full list. Events are actions or occurrences that happen in the system you are programming, which the system tells you about so you can respond to them in some way if desired. For most purposes, it's OK. Are there any drawbacks in crafting a Spellwrought instead of a Spell Scroll? ; capture: the phase where to handle the event, to be covered later in the chapter Bubbling and capturing.For historical reasons, options can also be false/true, that’s the same as {capture: false/true}. If you want to keep the ThisBinding (the value of this when the function is invoked, set to the element which triggered the event), then call the function with call(). For a start, it is not a good idea to mix up your HTML and your JavaScript, as it becomes hard to parse — keeping your JavaScript separate is best practice; if it is in a separate file you can apply it to multiple HTML documents. A good example is a series of list items — if you want each one to pop up a message when selected, you can set the click event listener on the parent