topskill.dev
CoursesTracks
0
All courses/DOM Manipulation with JavaScriptAdd a workshop session
Project — Workshop Planner
4 / 7
← DOM Manipulation with JavaScript
○Open the browser Console safely○Read results, fix a typo, and try again○Change your blank practice page○The page is a tree○follow the document reference○Load a script when the page is ready○initialize a deferred script○Find one element by id or CSS selector○select a notice and label○Compare DOM properties, HTML attributes, and node types○inspect a room input and its nodes○Initialize a page when it is ready✦Module Quiz
○Find every match with querySelectorAll○label every trail stop○Move from a child to its relatives○trace a nested card○Check for missing elements and search within a card○update only the chosen card○Compare a live HTMLCollection with a static NodeList○safely expand a live collection✦Module Quiz
○Safe text and HTML○render a safe notice○Read and change link attributes○update an accessible link○Data attributes and conditional text○announce session availability○Boolean attributes and DOM properties○unlock a volunteer sign-up✦Module Quiz
○Add, remove, and check classes○mark a favourite card○Toggle a panel accessibly○toggle the help panel○Inline styles, classes, and hidden○style and hide a notice○Change a CSS custom property from JavaScript○change a workshop card accent✦Module Quiz
○Create an Element and Append It○Add a Reading List Item○Place Nodes Before and Between○Order the Workshop Agenda○Remove, Replace, and Clear Safely○Refresh a Museum Display○Clone a Card and Insert a Batch○Clone Two Exhibit Cards✦Module Quiz
○Listen for Clicks with a Named Handler○Check Library Hours○Event Target, Current Target, and Delegation○Delegate Pantry Actions○Keyboard Events Without Trapping Keys○Search the Recipe Box○Once, Remove, and Bubble○Control Workshop Notifications✦Module Quiz
○Read a field while someone types○Build a live name preview○Handle submit without leaving the page○Validate a library request○Keep a selection in sync on change and reset○Sync a preference and its reset state○Read multiple checked values with FormData○Build a checkbox-based garden request○Read a number from a form✦Module Quiz
○Filter a list as someone types○Build a live trail finder○Toggle an accessible disclosure○Build a guide menu disclosure○Create and remove items with one delegated listener○Build a neighborhood task board○Sort a workshop table with accessible buttons○Build an accessible sortable resource table✦Module Quiz
○Read selectable cards and detail updates○Build directory cards and a selected profile○Trace live search and an empty state○Add live search to the community directory○Trace safe additions and delegated removal○Add and remove community directory cards✦Module Quiz
○Read and update a live itinerary○Build the workshop itinerary○Add a validated item through a form●Add a workshop session○Filter and remove live entries○Finish the workshop planner✦Module Quiz
○Fetch JSON and render safe text○load recipe cards○Handle loading, empty, and failed responses○handle alert states○Build a query with URLSearchParams○search the catalog○Abort outdated requests○keep the latest result✦Module Quiz
○Load a dashboard from an offline API fixture○Build an events dashboard○Query a dashboard with URLSearchParams○Add event search to the dashboard○Retry requests without stale results○Finish a resilient event dashboard✦Module Quiz

Add a workshop session

The previous demo added tools without parsing typed text. Here the itinerary from the first exercise is already working; extend it with a form. Each lesson opens in its own preview, so changes you made in the earlier editor are not carried over.

A different form might reject an empty shelf label like this:

javascript
const shelf = document.querySelector("#shelf-name");
if (!shelf.value.trim()) {
  document.querySelector("#shelf-error").textContent =
    "Name the shelf.";
  shelf.focus();
}

Your workshop also needs a time. sessions.push({ title, time, track }) appends one object to the array; title is shorthand for title: title when the property and variable share a name. Add that object, then call renderSessions(). Select #session-track and read its .value, just as you read an input value. The starter has labelled controls; wire their submission in script.js and update the accessibility attributes in index.html.

Duplicate sessions are allowed, even with the same title and time. Reset only the form after success, not the itinerary array. After the reset, focus returns to the title so the next session can be entered with the keyboard.

Your Task

  1. Link both title and time fields to #session-status with aria-describedby and give the paragraph role="status".
  2. Prevent navigation and reject a whitespace-only title: leave the itinerary unchanged, explain the problem, and focus the title.
  3. Reject a missing time in the same way, focusing the time field.
  4. Add a valid title, time, and track to sessions and render the new row with literal text, never parsed markup.
  5. Reset the form after a successful addition.
  6. Announce the added title in #session-status.
  7. Return focus to the title field after a successful addition.

The starter supplies separate blank-title and missing-time branches. Add their messages and focus behavior in order; leave their early returns in place. Preventing default submission belongs to the title-validation task and must run before either branch. Try a missing time, then enter a session with angle brackets in its title. The preview should show those brackets literally.

Files
  • ⋄index.html
  • ⋄script.js
  • ⋄style.css
Loading editor…