DOM Manipulation

Checkbox State

Checkbox State

Checkboxes store their current state in the checked property. That value is a boolean, so it should drive a clear branch in your UI update.

The summary should change when the checkbox changes, not only when the page first loads.

Your task: When the newsletter checkbox changes, update the summary. Checked should show Newsletter enabled and add is-enabled to the summary. Unchecked should show Newsletter disabled and remove that class.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Checkbox State

Checkboxes store their current state in the checked property. That value is a boolean, so it should drive a clear branch in your UI update.

The summary should change when the checkbox changes, not only when the page first loads.

Your task: When the newsletter checkbox changes, update the summary. Checked should show Newsletter enabled and add is-enabled to the summary. Unchecked should show Newsletter disabled and remove that class.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.