+ 2

what is problem with this code

im trying to change the button textcontent with event delegation please tell me whats wrong with this code https://code.sololearn.com/WE4AvR4S3a6H/?ref=app

29th Mar 2019, 5:51 AM
Danielov
Danielov - avatar
3 odpowiedzi
+ 6
Do you mean the error it's giving at line 2? If yes then it's because the JS part is getting loaded before the html window and hence it can't find the required element. Write your entire JS code inside a function which will be called once the html window gets loaded. You can do it like: window.onload=function(){ //your JS code goes here }
29th Mar 2019, 7:33 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 5
daneillonge it does work here
30th Mar 2019, 1:54 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 2
it works on other ide but solo doesnt support event handler properly
30th Mar 2019, 1:25 AM
Danielov
Danielov - avatar