var currentImageBox;
$('.newImage').bind('click', function() {
currentImageBox = this;
currentImageBox.unbind('click');
});
Im trying to set currentImageBox to the div that was clicked (a number of divs on the page have the newImage class). But to no avail, where am I going wrong?
The code is correct, the
thisis the element clicked. But to useunbind, you need to wrap the element with jQuery sincethis(and thereforecurrentImageBox) is the DOM element and not a jQuery object.