Getting the Image Source from an HTMLImageElement object
- by corymathews
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.