0
Simple JavaScript (DOM) code not working
I just finished the Javascript course and I tried on this particular code, but it doesn't work. Is something wrong? Do I need to install something first? CODE: https://code.sololearn.com/W3E97hAKy1fP/?ref=app
3 odpowiedzi
+ 6
Or
window.addEventListener('load', function () {
let username = prompt('ENTER USERNAME');
document.querySelector('.hello').innerHTML = username;
});
+ 5
onload = init;
function init() {
let username = prompt('ENTER USERNAME');
document.getElementsByClassName('hello')[0].innerHTML = username;
}