Cookie alert

Implement a cookie alert that asks the user to accept using cookies.

Requirements:

  • Display an overlay with two buttons. The provided code shows it by default.
  • If the user clicks Accept, the overlay should close, and data-test="consent" should display Yes.
  • If the user clicks Reject, the overlay should close, and data-test="consent" should display No.
  • By default data-test="consent" should display -.
  • Remember the decision in localStorage or cookies. After refreshing the page, don't ask for permission again.

You are free to add classes, styles, ids, but don't edit or remove data-test attributes.
Create an account to start coding
Create account