Interactive online courses HTML Academy
2026-03-09 12:25 Diff

We learned how to change the input field type. In order to complete the assignment, we need to change the password field type when the user ticks the “Show password” checkbox.

Show password

A checkbox is an input field that can have one of two states: checked or unchecked. The checkmark indicates the state of the checkbox in browsers: if the checkbox is ticked, then its checked state is true, otherwise it is false. When the checkbox is ticked or unticked, the status of the checkbox changes. To track this event from the script, use the onchange event handler.

The “Show password” checkbox has the show-password class. Find it, write it to a variable, and add a handler to it. Then move the instruction that changes the field type inside the handler. Then make sure that if you check the checkbox, the password will be visible.