jquery - How to get selector on which 'click' event has been bound? -


i'm using jquery on function bind click event:

$('#page-container, .some-class').on('click', '.do-something', function(event) {     // #page-container or .some-class? }); 

now inside callback function want know if 'click' event has been fired #page-container or .some-class. $(this) selector has been clicked.

delagatetarget property of event object refers target of delegation:

$('#page-container, .some-class').on('click', '.do-something', function(event) {     var dt = event.delegatetarget; }); 

http://jsfiddle.net/smxcg/


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -