I want to learn pure JS, I ran into a problem, it does not work:
(function () { document.getElementById('login').onclick = function () { alert(123); return false; }; })(); <a href="#" id="login">Войти</a>
You can do without simply inserting the onclick attribute into the tag, but it is interesting to do it using this method, but for some reason it does not work.