Agree to the Terms

Write the code, see it run, pass the checks.

The problem

  • easy
  • Code

A sign-up box has two radio buttons named "Free" and "Pro" for the plan, with Free chosen at first, a checkbox labelled "I agree to the terms" and a "Create account" button. The button is disabled until the box is ticked, and unticking it disables the button again. Clicking the enabled button replaces everything with "Account created on the Free plan" (or "Pro plan", whichever is chosen).

Your code must pass

  • Create account is disabled until the terms are ticked
  • Unticking the terms disables it again
  • The Free plan is chosen at first
  • Creating an account names the chosen plan