Skip to main content
Problem 1

Restricted Textarea

EASYBUILD
DOM+3

Given an integer maxLength, build a restricted textarea with a live character counter.

Use these test IDs: data-testid="app" (container), data-testid="restricted-textarea", data-testid="remaining-counter".

The counter text must be exactly {remaining} characters remaining. When remaining <= 10, turn the textarea border and counter text red (#e53e3e). Reset both when remaining rises above 10.

Examples
Example 1
Input
maxLength = 10
User types: "hello"
Output
Counter text: "5 characters remaining"
Example 2
Input
maxLength = 10
User pastes: "helloworld123"
Output
Textarea value: "helloworld"
Counter text: "0 characters remaining"
Note

Input truncated to maxLength.

Constraints
  • 1 <= maxLength <= 500
  • Counter text must match the exact format
Follow-up

Use CSS classes instead of inline styles — add a `.warning` class and use `classList.toggle()`.

Hints
Console output will appear here...