How to call a JavaScript function after script is loaded?

Spread the love

To call a JavaScript function after script is loaded, we set the onload attribute.

For instance, we write

<script onload="loadedContent();" src="/myapp/myCode.js"></script>

to set the onload attribute to call the loadedContent JavaScript function.

Leave a Reply

Your email address will not be published. Required fields are marked *