Sanjay Kumar N S
Sanjay Kumar N S

Reputation: 4739

What is the .load() equvalent function in firefox browser(All versions)?

The below code does not alert the message in firefox especially version - 39.0.

$(document).ready(function(){
    $('#test').load(function(){
            alert('loaded');
    });
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<img class="content_tag" id="test" src="ACTUAL IMAGE PATH"/>

Upvotes: 1

Views: 46

Answers (1)

Rohit Arora
Rohit Arora

Reputation: 2252

First of all Your jquery library should be before your code like this:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $('#test').attr('src', 'http://www.youtube.com/v/h60r2HPsiuM');
    $('#test').load(function(){
            alert('loaded');
    });
});
</script>
<img class="content_tag" id="test" src="ACTUAL IMAGE PATH"/>

Please check this out Bug #11733 and SO discussion on this bug which states that .load() is depreciated now and .on('load') replaces it.

$('#test').on('load',function(){
     alert('loaded');
});

Upvotes: 3

Related Questions