Side navigation
#6860 closed enhancement (invalid)
Opened August 03, 2010 01:40AM UTC
Closed August 04, 2010 01:07AM UTC
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: |
Description
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 } }
Attachments (0)
Change History (1)
Changed August 04, 2010 01:07AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
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?
http://api.jquery.com/event.target/
Since it's not supported cross-browser you shouldn't depend on it being there.