0%

Skip to content

The DOM and an interactive transaction form

Intermediate~35 min0/4 steps

Let a person use the ledger

The DOM is the browser's object model for the page. JavaScript can listen for a form submission, read its fields, update application state, and render the new result.

This is the turning point: Smart Ledger stops being a script and becomes an application.

Instructions

1

Select the form and list with querySelector.

Hint: document.querySelector('#transaction-form')

Where does this go?

// Listen for submit, prevent the refresh, push an object, and render.

Write it on line 6 — under that comment, after the code you already added.

2

Create renderTransactions and render array items with map.

3

Listen for submit and call preventDefault.

4

Push a transaction object and render again.

Your Code

html
6 lines
1
2
3
4
5
6

Live Preview

Live Preview

Build your next project with Builder

Ready to build agents and automate real work? Builder unlocks the full Agent Builder and Claude × Excel courses, Studio Build Credits and Build Blueprint. Your free Fundamentals lessons remain available.

  • 500 Studio Build Credits a month
  • Build Blueprint: a clear spec for any idea, ready for your AI agent
  • Every lesson in the other full courses

$19 a month

Full refund within 14 days on new subscriptions. Cancel anytime.

The payment page is run by Lemon Squeezy, our payment provider. If it opens in a language you don't read, switch it in the language menu at the top of that page.

See pricing

Builder does not include third-party AI subscriptions. Lessons that need one say so up front.