Reputation: 2076
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
Reputation: 2198
You can try checking if image is loaded:
$("img").bind("load", function(){
alert("image has been loaded");
});
Upvotes: 2
Reputation: 1929
$(".fileupload-new").click(function() {
alert("check value of img src");
});
Upvotes: 2