1. Build this in Design Mode first
STEP 1Create these elements on screen1 with these exact IDs and starting text.
| Type | ID | Text |
|---|---|---|
| Label | promptLabel | Enter your age: |
| TextInput | ageInput | (leave blank) |
| Button | checkBtn | Find My Price |
| Label | echoLabel | You typed: -- |
2. Switch to Code Mode
STEP 2Copy this starter code into Code Mode and fill in the marked STEP.
onEvent("checkBtn", "click", function() {
// Read ageInput with getText() and echo the raw value into echoLabel.
});
3. Check yourself — predict before you test
STEP 3| Input | What it should test |
|---|---|
| 12 | a normal value echoes back exactly |
| (empty) | unexpected value — what does an empty field echo? |
| twelve | unexpected value — text where you might expect a number |
Try it for real before checking the answer key.
Answer key
onEvent("checkBtn", "click", function() {
var typedValue = getText("ageInput");
setText("echoLabel", "You typed: " + typedValue);
});