Код: Выделить всё
const button = document.getElementById('button')
button.onclick = function() { console.log('onclick'); } // overwrites the inline handlers
button.addEventListener('click', function() { console.log('listener'); }); // adds to the event handlers< /code>
Why not click and find out?Подробнее здесь: https://stackoverflow.com/questions/797 ... -the-other
Мобильная версия