Skip to content Skip to sidebar Skip to footer

Run Javascript Function When Object Content Has Been Loaded

How do I run a Javascript function when the content of an has been loaded? The DOMContentLoaded event fires before that, and things that rely on it like JQuery's $()

Solution 1:

Does using the onload DomEvent work?

<object onload="changeColor()" data="circles.svg"type="image/svg+xml"id="circles"></object>

see my it here

Solution 2:

You should use onload/ready event of jquery - http://api.jquery.com/ready/

$('#circles').ready(function(){
    changeColor();
});`

Post a Comment for "Run Javascript Function When Object Content Has Been Loaded"