Bug Tracker

Opened 13 years ago

Closed 13 years ago

#6860 closed enhancement (invalid)

Documentation for event.originalTarget

Reported by: josh.oxide Owned by:
Priority: Milestone: 1.4.3
Component: event Version: 1.4.2
Keywords: event, documentation Cc:
Blocked by: Blocking:


I recently came across a use case for event.originalTarget, and it would have been nice had documentation existed on the site detailing that it existed, and how to use it.

The use case was that I was binding a click event to an a tag, but I only wanted it to fire if what was clicked was the a element itself, and not any of its children. (It contained some form elements).

Example code:

$('a').click(function(event) {
    if(event.originalTarget == this) {
        //Whatever you actually want to do

Change History (1)

comment:1 Changed 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

Despite the property being added in #2814, event.originalTarget isn't a standard event property and should be removed. Perhaps event.target works for this situation?


Since it's not supported cross-browser you shouldn't depend on it being there.

Note: See TracTickets for help on using tickets.