Loading workspace…

Todo List

Michal GrzegorczykSenior Front End Engineer, Ofair
Languages

You're given the HTML for a Todo List app. Add support for creating tasks and deleting existing ones.

Requirements

Add the following functionality to the app:

  1. Add new tasks on clicking the "Submit" button.
    • The <input> field should be cleared upon successful addition.
    • Treat task input as plain text; user-provided markup must not be interpreted as HTML.
  2. Remove tasks from the Todo List upon clicking the "Delete" button.

Give the task input an accessible label so the form is operable with assistive technology.

Notes

  • The focus of this question is on functionality, not styling. There's no need to write any custom CSS.
  • You may modify the markup (e.g. adding ids, data attributes, replacing some tags, etc.), but the result should remain the same visually.
  • You may want to think about ways to improve the user experience of the application and implement them (you get bonus credit for doing that during interviews).

Changelog

  1. Blank tasks in Svelte and Vue

    The Svelte and Vue solutions reject submissions that are empty after trimming whitespace.

  2. Task text and input label

    Render entered tasks as plain text, including text that resembles markup. The task input also needs an accessible label.

  3. Blank tasks in React and Vanilla JavaScript

    The React and Vanilla JavaScript solutions reject empty or whitespace-only tasks when the user adds an item.