JS onload event

0 votes
added Mar 23, 2018 in Javascript by LC Marshal Captain (25,790 points)
edited Jul 13, 2018 by LC Marshal

The onload event can only be used on the document(body) itself, frames, images, and scripts. In other words, it can be attached to only body and/or each external resource. The div is not an external resource and it's loaded as part of the body, so the onload event doesn't apply there. 

onload event it only supports with few tags

<body>, <frame>, <iframe>, <img>, <input type="image">, <link>, <script>, <style>

src: https://stackoverflow.com/questions/4057236/how-to-add-onload-event-to-a-div-element

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.