var $content = $('#SomeDivContainingTwoImages');
$content.children().each(function(i){
$(this).showImage = showImageStatic;
$(this).showImage();
});
returns
Uncaught TypeError: Object #<Object> has no method 'showImage'
when run. This works outside of the jquery each iterator, ie if I just apply it to a single element. What’s up?
You are re-creating a jQuery object with every call to $(this).
This should work:
But I think that’s not a very good way of handling it. You could call showImageStatic() directly: