console document.querySelector(...) is null

Created on 5 April 2024, 8 months ago
Updated 7 April 2024, 8 months ago

if off option -until manually closed- then console warning

Uncaught TypeError: can't access property "addEventListener", document.querySelector(...) is null

I'm not very good in JS))
js/conditional_message.js

            // Close button.
/*WTpatchOwn: document.querySelector(...) is null*/
            //document.querySelector('.conditional-message span').addEventListener('click', function () {
            let closeButton = document.querySelector('.conditional-message span');
            if(closeButton) closeButton.addEventListener('click', function () {
/*<<<*/
              let cmKey = this.parentElement.getAttribute('data-cm-key');
🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024