Addeventlistener for User Profile Block

Hi,

I can find the addeventlistener for form and list block, however, how about user accounts block?

I am trying to have a redirection to specific link after pressing the update button, however, it is not working, just wonder if the eventlistener is not correct.

<script>
window.addEventListener('submit-form-user-accounts1', (e) => {
  console.log('form submit success', e.detail);
  const redirectUrl = `https://www.couponly.io/summary`;
  setTimeout(() => {
    window.location.href = redirectUrl;
  }, 2000);
});
</script>

Hope to have some advice on it.

Tks & Bgds

Eric

Hi @twmeric please, insert this custom code into Page Settings>Custom Code>Header field to redirect to the mentioned url once the Profile information is successfully updated on User Profile block

<script >

    function addClassNameListener(elemId) {
        var elem = document.getElementById(elemId);
        if (!elem) {
            return;
        }
        window.setInterval(function() {

            if (elem.classList.contains('sw-btn-success')) {
                const redirectUrl = `https://www.couponly.io/summary`;
                setTimeout(() => {
                    window.location.href = redirectUrl;
                }, 2000);
            }
        }, 1000);
    }

window.addEventListener("load", (event) => {
    addClassNameListener("sw-update-profile-btn");
});

</script>