+ 3
Can I add an attribute to the newly created element in Javascript?
In JS i made new button I can add to it attribute onclick? if so , how?
2 ответов
+ 3
Hello, Ω-mega !
.onclick should be set to a function instead of a string. Try
elemm.onclick = function() { alert('hello, world'); };
+ 3
Thank you