I need to identify elements from which events are fired.
Using event.target
gets the respective element.
What properties can I use from there?
href
id
nodeName
I cannot find a whole lot of info on it, even on the jQuery pages, so here is to hoping someone can complete the above list.
EDIT:
These may be helpful: selfHTML node properties and selfHTML HTML properties
event.target
returns the DOM element, so you can retrieve any property/ attribute that has a value; so, to answer your question more specifically, you will always be able to retrieve nodeName
, and you can retrieve href
and id
, provided the element has a href
and id
defined; otherwise undefined
will be returned.
However, inside an event handler, you can use this
, which is set to the DOM element as well; much easier.
$('foo').bind('click', function () {
// inside here, `this` will refer to the foo that was clicked
});