Damir
Damir

Reputation: 56199

Call javascript on end loading page

How to call javascript function at the end of loading page ? I add at the end of page, but is there any other way ?

Upvotes: 2

Views: 3489

Answers (3)

bluefoot
bluefoot

Reputation: 10580

If you're using jquery, you can use ready()

Upvotes: 2

Shamim Hafiz - MSFT
Shamim Hafiz - MSFT

Reputation: 22114

Adding it to the end is actually wrong because of the way it may behave with different browsers.

You should add it to the onload event of the body tag.

e.g

<body onload="DoAfterPageLoad()">

Upvotes: 2

Geo
Geo

Reputation: 96867

Use onload

Upvotes: 5

Related Questions