View on GitHub

Code Fellows reading notes

A repository for organizing notes from my learning.

Forms and JS Events

Forms

Forms allow a user to interact with your webpage in some way or another. They can allow the user to add text, make choices, and submit items to your website.

Form Structure (HTML)

Lists, Tables, and Forms (CSS)

CSS has unique properties for styling lists, tables and forms.

Styling Lists

Styling Tables

Styling Forms

Forms and form inputs obey the same rules as other elements and can be styled similarly.

Events

Events are used to trigger a function or script. When triggering a function, do not include parentheses.

The JS Event object includes many different event to track and they can be implemented in one of two ways:

//Event handlers can only trigger one function:
element.onevent = functionName;

//Event listeners are more complex but can deal with multiple functions:
element.addEventListener('event', functionName, Boolean);

//Passing arguments to an event handler or listener requires a workaround using an anonymous function
element.addEventListener('event', function() {functionName(arg)}, Boolean);