get img src from an img loaded dynamically using jQuery

Posted by Lee on Stack Overflow See other posts from Stack Overflow or by Lee
Published on 2010-04-26T01:03:29Z Indexed on 2010/04/26 1:13 UTC
Read the original article Hit count: 515

Filed under:
|
|
|

Hey Guys (and Ladies)

I am looking at getting the image name from an image with a src loaded dynamically. Basically what I am doing is using the Google chat badge on a site to live chatting. And else where on the page, I have an image saying Live Chat:Online or Live Chat:Offline. And I want this to change depending on whether I am available to chat or not. Does this make sense?

Anyway, the easiest way I figure to do this would be check the img url. If the img is offline.gif then obviously I am offline.

An example of a dynamically loaded img would be something like

<img src="http://www.google.com/talk/service/badge/Show?encrypted_acount_id_here" />

Once this image has loaded, it loads one of the following images "http://www.google.com/talk/service/resources/offlinef.gif" "http://www.google.com/talk/service/resources/idlef.gif" "http://www.google.com/talk/service/resources/onlinef.gif"

Hopefully this make sense now.

Thanks heaps

© Stack Overflow or respective owner

Related posts about google

Related posts about jQuery