I have a bunch of images on my ASP.NET page like so:
for (int i = 0; i < 3; i++)
{
Image image = new Image();
image.ID = "UpdateStatus";
image.CssClass = "imageCss";
image.ImageUrl = "Bump.GIF";
this.Controls.Add(image);
}
I want to loop through each image.
Why does this not work? i.e. "Function 1" is outputted but "Function 2" is not
$(document.body).click(function () {
console.log('Function 1');
$('imageCss').each(function(){
console.log('Function 2');
});
});
Why does this not work? i.e. "Function 1" is outputted and "Function 2" outputted ONCE. Why not 3 times?
$(document.body).click(function () {
console.log('Function 1');
$(''#UpdateStatus'').each(function(){
console.log('Function 2');
});
});
This works fine BUT i cannot access 'this', it is NULL. I need to be able to reference the current image.
$(document.body).click(function () {
console.log('Function 1');
$.each('#UpdateStatus', function() { //Or when I use 'imageCss'
console.log('Function 2');
console.log(this);
});
});