joao86
joao86

Reputation: 2076

determine if image src has changed

I have img tag that a shows the user avatar. When he pushes a button to edit the image and selects a new one, the img src on the page changes to the new image src.

How can I know when the src changes?

This is the code to the button that user presses to change the image.

<div style="width: 80px; height: 80px; line-height: 80px;" class="fileupload-preview fileupload-exists thumbnail"></div>
                                                    <span class="btn btn-file"><span class="fileupload-new">Select image</span>

As you can see it is not button tag.

Upvotes: 1

Views: 1422

Answers (2)

gregmatys
gregmatys

Reputation: 2198

You can try checking if image is loaded:

$("img").bind("load", function(){
    alert("image has been loaded");
});

Upvotes: 2

SSH This
SSH This

Reputation: 1929

$(".fileupload-new").click(function() {
  alert("check value of img src");
});

Upvotes: 2

Related Questions