Getting the Image Source from an HTMLImageElement object
Posted
by corymathews
on Stack Overflow
See other posts from Stack Overflow
or by corymathews
Published on 2010-03-24T15:19:51Z
Indexed on
2010/03/24
15:23 UTC
Read the original article
Hit count: 650
jQuery
I have the following jQuery which I want to output a list of images. The problem is that I cannot get 'this' to find the source. It currently is an object which outputs as an HTMLImageElement. How can I get the image source from this object?
$("#imgs li.images img").each(function(i) {
$("#list").append("<li><img src=\""+this.attr("src")+"\" /></li>");
});
I currently get the error that this.attr is not a function.
© Stack Overflow or respective owner