codex-lv2-may-2025

Level Navigation: 1 2 3 4 5 6 7 8 9 Current Level: 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32


đź§Ş Level 10: Button Event Wiring

What You’ll Do

Wire up the button click event.

Instructions

Use onEvent("buttonId","click", function() { ... }) to wire the button. Inside, log "clicked" to the Console.

đź’ˇ Code Hints

Wiring up button clicks? You’ll need to use the onEvent function to listen for button clicks. Check out the Event Handling section in SNIPPETS.md for the exact syntax.

📚 Connect to Previous Lessons

Working with button events? Check out Week 5, Lesson 2: Buttons and Events for a complete guide to event handling and the onEvent function.

âś… Check

  1. Open your webpage in a browser
  2. Open Chrome DevTools (F12) and go to the Console tab
  3. Click your Send button
  4. You should see “clicked” appear in the Console
  5. If nothing happens when you click, check that:
    • Your button ID matches exactly in the onEvent call
    • The onEvent function is properly defined
    • There are no JavaScript errors in the Console

Next: Level 11 - Input Value Reading



Level Navigation: 1 2 3 4 5 6 7 8 9 Current Level: 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32