
A quick introduction on the content covered in this crash course, and a look at the eventual user interface we'll be building in the final lecture.
I want to make it as easy as possible for you to consume this course, so in this lecture I'll take you through my environment setup, as well as the directory structure for all lectures.
Learn how to access the DOM by selecting an element with an id using document.getElementById, capture the colors list, and inspect it in the browser console.
Discover how the querySelector method replaces getElementById for selecting a single element using CSS selectors, covering id, class, tag name, and the switch to querySelectorAll for multiple elements.
Use querySelectorAll to select multiple elements and handle the resulting node list, then restrict scope by querying within a specific container like a colors list.
Inspect document object model elements with the console to view properties such as client width, client height, and inner HTML, using query selector and console.dir.
Learn how to retrieve attributes from HTML elements using JavaScript's getAttribute method, including title and class, with querySelector, console logs, and hasAttribute checks.
Explore how the children property returns a live HTMLCollection of a parent's children, demonstrated with a skills list and a card. Compare it with querySelectorAll and understand live updates.
Traverse the dom from a child to its ancestors by selecting a list item and moving up via the parents element, up to the card, the list, and the document.
Learn how the closest method finds the nearest ancestor matching a selector in the DOM, using a thesis item to its skills and card.
Use the textContent property to read an element's text, such as the name div containing Adam Jones. Observe that textContent excludes nested tags and preserves whitespace, which you can trim.
Learn to update HTML element attributes with setAttribute, changing the title shown on hover and toggling classes like name and coffee to alter styling.
Apply inline CSS with JavaScript by accessing an element's last child and setting style properties in camel case, such as color and backgroundColor, then remove styles to revert to CSS.
Learn to update, create, and delete elements by changing the innerHTML of a DOM element, using backticks to craft multi-line strings and update an unordered list’s HTML.
Learn to insert HTML into an element with the insert adjacent HTML method, using before end, after end, before begin, and after begin to update a list with new data.
Learn how to update an element's text using the textContent property, compare it with innerHTML, and understand when to use text content for safe, data-driven UI updates.
Use the class list api to manage an element's classes by adding, removing, checking for existence, and toggling them, instead of set attribute or class name, to update styling reliably.
Learn to dynamically create and assemble HTML elements with the JavaScript dom using createElement, classList, setAttribute, and textContent to build a card with a name and skills list.
Learn how to remove elements from the DOM using the removeChild method, including removing a specific child and clearing all list items with a while loop.
Explore removing a child element without the parent by using the DOM remove method. Compare it with removeChild for compatibility and learn when to apply each in modern browsers.
Explore adding interactivity to HTML elements with click events using addEventListener, validating a username against a sample list with alerts, and handling change, input, and blur events.
Explore the event object and how an event listener passes data through the e parameter. Discover how it reveals pointer event types, the control key state, and the event target.
Learn how to prevent a form's default submit behavior with the event's preventDefault method, set up a submit event listener, and prepare for asynchronous form handling with fetch.
Learn how the defer attribute prevents the common DOM loading error by delaying script execution until the DOM exists, offering a modern alternative to placing scripts at the bottom.
Update the page title on the fly with JavaScript by assigning document.title, then update it every second with setInterval to track how often it changes in dynamic web applications.
Learn how to access HTML5 data attributes with JavaScript using the dataset property, camel case conversion, and dynamic messaging on button clicks.
Build an interactive sticky notes UI using the JavaScript DOM, creating, styling, and appending notes, updating a live count, and deleting notes with double-click confirmation.
Welcome to the Ultimate JavaScript DOM Crash Course!
Let's cut to the chase - here's what you'll be learning in this course:
selecting HTML elements
inspecting objects within the DOM and gaining a deeper understanding of what features and functions are available
getting data from HTML elements
updating HTML elements, including text content and adding more HTML
creating HTML elements - this one is important as it's key to building interactive user interfaces
deleting HTML elements
adding events to your webpage to increase interactivity
and much more!
Once we've taken a look at the fundamentals, we'll have a go at a practical example - building a sticky notes user interface with the JavaScript DOM. Don't worry about the HTML and CSS, I'll be providing that for you.
Learning how to interact with the JavaScript DOM, and having good knowledge of the methods and properties available to you is critical to becoming an exceptional front-end web developer, and I hope this crash course can give you an inspiring introduction to the diverse world of the JavaScript DOM.
Another thing to note - if you intend to begin building websites using front-end frameworks such as React or Vue, I highly recommend you watch this crash course first before doing so. Front-end frameworks are fantastic tools but it's a good idea to have a solid understanding of the JavaScript DOM without those frameworks doing all the heavy lifting for you.
I hope to see you in the lectures!