In this video we will learn how to detect changes in checkbox field and act on it accordingly.

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Checkbox JS events</title>
    <h1>Register account here</h1>
    <form action="">
            <legend>Fill in the details</legend>
            <p>Username: <input type="text"></p>
            <p>Name: <input type="text"></p>
            <p>Password: <input type="password"></p>
            <p>Confirm Password: <input type="password"></p>
            <p><input type="checkbox" id="agree">
            <label for="agree">I agree to terms and conditions</label>
            <input type="submit" value="Register" id="register" disabled>

        let agree = document.getElementById("agree");
        agree.addEventListener('change', function() {
            let register = document.getElementById("register");
            if(agree.checked) {
            } else {
                register.setAttribute("disabled", "disabled");