$(document).ready(function () {
  function init() {
    const checkbox = $('#account-deletion-check');
    const submitButton = $('#account-deletion-submit');

    function changeButtonState() {
      submitButton.prop('disabled', !checkbox.prop('checked'));
    }

    // check if checkbox is checked on page load
    changeButtonState();

    checkbox.on('change', function () {
      changeButtonState();
    });
  }

  init();
});
