Filip Stojanovic
Filip Stojanovic

Reputation: 33

JavaScript - event owerriten by outer class element

I am sending two events here one when clicking on the specific div to mark the start of using form elements and the second for a specific input field inside the div.

When the inner div is clicked, it shows up for a second and then gets overwritten by the outer class element again.

$$('.form-block-company-logo').on('click', function (event) {
            sendToDataLayer({'event': 'form_creation', 'form_name': 'company_logo_add', 'step': '1'});
        });

        $$('#logo-upload').on('click', function () {
            sendToDataLayer({'event': 'form_creation', 'form_name': 'company_logo_select', 'step': '2'});
        });

Specifically when clicking on it gets #logo-upload it triggers company_logo_select for a second then gets back to the company_logo_add event. How to resolve this issue?

Thanks

My HTML: https://codepen.io/Filip-Stojanovic-the-typescripter/pen/YzdzyvO

Upvotes: 0

Views: 21

Answers (0)

Related Questions