my name is Ezequiel, I'm new with JQuery
I want to dynamically change the src of an and get the width of the image that it's displayed.
I have an img tag, with an ID ("idImg").
The problem is that my code works only for the first src change, and I have to change it multiple times (iterative), but I'll show you with only 2 hardcoded changes.
$("#idImg").attr("src", scrString); //src field changes ok
alert($("#idImg").width()) // ok, this is the real width.
$("#idImg").attr("src", scrStringANOTHER); //src field changes ok
alert($("#idImg").width()) // nope, it keeps the same width than the last one.
I don't know, just cannot find out what the problem is
EDIT: I know I have to wait until it loads, but that doesn't work if I change the src multiple times. I need to change the src multiple times, and check the resulting width of each image.
Any help?
Ty very much
Ezequiel.