Q:

Getting click event on element where user has clicked

I want get information about the currently clicked html element. For that I used $(*).click() event so that every element on the page will have this event.
suppose I have following html code
<div class="outer">
     <div class="inner">
           <p>Hello<p>
      </div>
</div>

now when user clicks hello I want to get that element so that I could identify its tag, its class etc.
But here is the problem, when user clicks on hello, click event get fired but it get fired on p tag , then div class=inner and then on div with class as outer . But here i want to get event only on the text or area where user has clicked.

A:

Please use $(document).click() instead of $(*).click() and use e.target to get specified. 
element.
You can stop the event bubbling by using e.stopPropagation();
$(document).click(function (e) {
   e.stopPropagation();
   alert('Tag Name: ' + e.target.tagName + 
           ' --has class: ' + e.target.className + 
           ' --with text: ' + $(e.target).text());
});

DEMO: http://jsfiddle.net/Q6cpR/1/

