Run javascript after page load

Benyamin picture Benyamin · Apr 1, 2011 · Viewed 42.5k times · Source

setup_account ui-mobile-viewport ui-overlay-c

When a page i make loads like this:

var location    =   location.href+"&rndm="+2*Math.random()+" #updatecomment0>*"
$("#updatecomment0").load(location, function(){});

I have multiple scripts running on the updatecomment0 div:

<div id="updatecomment0">
    <div id="javascript1">hi</div>
    <div style="float:right;" class="javascript2">delete</div>
</div>

I don't know how to make this other JavaScripts run after page load.
Can someone please tell me how to with this.
Thank you

Answer

Chetan picture Chetan · Apr 1, 2011

Use $(document).ready().