Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DIV: Completely rendered indicator event

I need to call a javascript function when a div is fully rendered. But, I am not aware of the right event to use.

Appreciate your help.

like image 637
Akram Shahda Avatar asked Jan 25 '26 08:01

Akram Shahda


2 Answers

You could put a script inline within the document that calls your function or executes. Just put it logically where it should be rendered.

<html>
    <body>
        <div><h1>Wait for it!</h1></div>
        <script type="text/javascript">
            document.write("<h2>Js process</h2>");
            alert("Stopping document process");
        </script>
        <div><h3>Done!</h3></div>
    </body>
</html>
like image 146
daganh Avatar answered Jan 26 '26 21:01

daganh


No events, just create a callback function, after the writing of html is finished, call your callback routine.

function x ( html, callback) {
     divElement.innerHTML = html;
     callback();
}
like image 44
Jake Kalstad Avatar answered Jan 26 '26 22:01

Jake Kalstad