Answer the question
In order to leave comments, you need to log in
Why is the JavaScript console not working in Vs code?
let page = document.querySelector('.page');
page.classList.remove('light-theme');
page.classList.add('dark-theme');
let themeButton = document.querySelector('.theme-button');
themeButton.onclick = function () {
console.log('Кнопка нажата!');
};
Не выводится сообщение в консоль. Что делать?
Answer the question
In order to leave comments, you need to log in
Try this, and go to the browser console and not the editor.
With your code, it was displayed in my browser, so it's working.
themeButton.addEventListener("click", function() {
console.log('Кнопка нажата!');
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question