JavaScript in the browser
Using everything you know on real pages: finding and changing elements, responding to people, loading data from a server, and remembering it between visits.
About 10 hours of study
Learning objectives
- Change a page through the DOM
- Respond to clicks, typing and forms
- Load data and show loading and error states
- Save data in the browser safely
Lessons
- 1
HTML and CSS
The structure of a web page: elements, tags and attributes, the head and body, headings, lists, links, images and forms; and CSS: selectors, the box model, colours and a flexbox layout.
- 2
The DOM: changing the page with JavaScript Intermediate
The Document Object Model: the page as a tree of objects, finding elements with querySelector, changing text, attributes, classes and styles, and creating and removing elements.
- 3
Events and forms Intermediate
Making a page respond: addEventListener, the event object, clicks, typing and form submits, preventDefault, event bubbling and delegation, and a small to-do app.
- 4
Fetching data and saving it Intermediate
How a page talks to a server with fetch and JSON, how to show loading and error states, and how to remember data in the browser with localStorage.
Module practice
- A profile cardEasy
- Ready for a scriptMedium
- A toolbar with statesHard
- Change the page from a scriptEasy
- A list built from dataMedium
- A report tableHard
- A click counterEasy
- Check a form before accepting itMedium
- A to-do list with delegationHard
- Show data from a serverEasy
- Loading and error statesMedium
- Notes that are rememberedHard