Answer the question
In order to leave comments, you need to log in
Error in console "Cannot read property 'addEventListener' of null", how to solve?
The console swears at my code.
I’m just learning the language and after reading I realized that everything seems to be in DOMContentLoaded, they say it loads the page and layout but does not have time for individual files, and on the basis of this there is a conflict.
But after reading something, I did not fully understand how to fix it.
My code:
document.addEventListener('DOMContentLoaded', () => {
const cartBtn = document.getElementById('#cart');
const openCart = () => {
cart.style.display = 'flex';
};
cartBtn.addEventListener('click', openCart);
});
Answer the question
In order to leave comments, you need to log in
1) judging by the fact that all sorts of date attributes are hung on the form - something third-party is already using it, look in the inspector what hangs on this form from the listeners.
2) try
$('#form88826033').submit(function(e) {
// я бы еще попробовал $('.t-form_inputs-total_3').submit(function(e) {
e.preventDefault();
console.log(this);
_rc('send', 'order', {...
The code should not be posted as a picture. In getElementById, you don't need to use # in front of the selector.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question