Ответ Магнара правильный, если вы хотите знать, к какому типу элемента обработано событие (к которому вы прикрепили событие). Если вы хотите точно знать, какой элемент был выбран, включая его дочерние элементы, вам необходимо свойство event.target . Используя пример Магнара:
// show the type of the element that event handler was bound to
function handle_click() {
var clicked_element = this;
alert(clicked_element.nodeName);
}
// show the type of the exact element that was clicked, which may be a child
// of the bound element
function handle_child_click(e) {
var clicked_element = e.target;
alert(clicked_element.nodeName);
}
// show the type of the element that matches "#myLink"
$("#mylink").click(handle_click);
// show the type of the element that matches "#myLink" or any of its children
$("#mylink").click(handle_child_click);