0
Guys I have an img tag that has a button that loads several images for the person to choose, so he chooses the src of this tag is changed. I need to detect when this src change happens and show an alert. I tried with the onchange but it did not fire, with the load worked but it also fired on the page loading because as soon as the page loads there appears a standard image.
$(".imagem").on("change", function(e){alert("alterou")});
It is not better to do that where the image is changed?
– Lucas
Whether the user chooses when to change the
src
why don’t you use that event/moment? you want to knowload
of that image when thesrc
change only? Then you can join that Handler Event you have on top > change tosrc
> remove Event Handler when theload
be called– Sergio
@Sergio I couldn’t understand your explanation.
– Joao Nivaldo
@Lucas I really need to check the change of SRC has no way to be when the image is changed.
– Joao Nivaldo
What’s the code for when "the person chooses"?
– Sergio
@Sergio is in a modal with an image gallery. When he chooses the image he triggers this code: `$('#image'+column, window.parent.Document). attr('src', file);
– Joao Nivaldo
@Joaonivaldo then you can detect there when the image changes and show the right alert?
– Sergio