$lightbox.find('.lb-outerContainer').on('click', function(e) { if ($(e.target).attr('id') === 'lightbox') _this.end(); return false; });
$lightbox = $('#lightbox');
is the parent of the .lb-outerContainer
. If I understand correctly, the “click” should go up the DOM
, find the #lightbox
element and click on it. ( if ($(e.target).attr('id') === 'lightbox') _this.end();
test will work if ($(e.target).attr('id') === 'lightbox') _this.end();
and the .end()
method will be .end()
). But it does not. Can anyone explain why?
Html there such.
.