Maybe this is a very stupid question, but not stupid enough for me since I can't seem to figure this out (even with Google).
I have this jquery:
$.each(items, function (key, t) {
$("#list").append(
$("<li />")
.append($("<img />")
.attr("src", "path/to/" + t.Thumbnail)
.addClass("thumb"))
.append($("<span />")
.html("<b>" + t.Title + "</b><br />" + t.Description)));
});
After this I loop through the thumbs to do some styling (with size and ratio, not relevant here)
$(".thumb").each(function () {
console.log($(this));
});
In the console I see this:
[img.thumb, context: img.thumb, jquery: "1.9.0", constructor: function, init: function,
selector: ""…]
0: img.thumb
context: img.thumb
length: 1
__proto__: Object[0]
What is this context? With $(this).width() it gives an error or 0. When I have an image that is already on the page it just...works?!
So, the problem is: Why doesn't this work and why does it work on other pages?
Thanks in advance
EDIT: Added an example to Fiddle: http://jsfiddle.net/nN9ce/