Forms are important because they are one of the main points of interaction between a user and a website or application. They allow users to input data, which is usually either sent to a web server or used on the client-side immediately to update the interface.
Source: Smashing Magazine, UX And HTML5: Let’s Help Users Fill In Your Mobile Form (Part 1)
Visually grouping fields that belong together will also help users fill a form.
Display only the fields that people need, and ask for optional things at the end
Present fields in a single-column layout.
In portrait mode, display the label on top of the field. In landscape mode, put labels on the left and inputs on the right.
Source: MDN, How to structure a web form
Source: MDN, Introduction to events
Events are user interactions that you write your code to prepare for, such as a user clicking a button.
Source: w3, HTML DOM Element addEventListener()
The event type to listen for
The function that will run when the event occurs
The event object is an object that contains information about the event that has occurs.
The target tells you which HTML element was interacted with and triggered the event.
Event bubbling describes how the browser handles events targeted at nested elements. Event capturing is like event bubbling but the order is reversed: so instead of the event firing first on the innermost element targeted, and then on successively less nested elements, the event fires first on the least nested element, and then on successively more nested elements, until the target is reached.