Hi Marcus,

I think you'll find some useful information here:

http://docs.jquery.com/Events/bind#typedatafn

You were on the right track. You can use the "target" property of the event object.

$(document).click(function(event) {

        $(event.target).empty();
        
        // in case you click on an element with a default...
        return false;

});



--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Jan 27, 2008, at 11:29 AM, marcus wrote:


hi,

I was playing around a it and was trying to simply catch every click-
event with something like this

$(document).click(function(event) { });

but what i just don't understand is how i can now access the element
that was orginally receiving the click.

$(this).empty() empties the whole document, which makes sense and I
found out that I can e.g. get the text I clicked on with
event.explicitOriginalTarget.nodeValue. But that's unfortunately
all...

Can someone tell what would be the working "version" of

$(event.explicitOriginalTarget).empty(); (It's just to make clear what
I'm trying...)


Reply via email to