0
onload event in divs is not working
I tried to use onload event in a div, but it's not working Here onload is working https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onload_html I don't want to use onload in body/html / or to use addEventListenr https://code.sololearn.com/WszlNRY8n9Vm/?ref=app
4 ответов
+ 3
You can't access that DOM element until it's loaded, so you have to add onload in window before you add event on div.
Or, put your script after your HTML element(before </body>)
+ 3
No you can't use onload event on any element except body.
+ 1
RDC
Can't I add onload directly in a div in HTML part ?
+ 1
RDC
Ok, I got it.
Thank you so much