You can always use the element itself as a selector. For example, using $ (this) inside a click handler wraps the current element inside a jQuery object.
$('p').click( function() { var html = $(this).html(); ... more computing... });
If you need a row selector for a specific element, this will be harder. You will need to go back up using parent () and prev () (to get offsets for similar elements at each level), unless the element has an identifier then you can just use it.
You might be better off creating a unique class that you can assign and reference it this way.
var counter = 0; $('p').click( function() { var uniq = 'paragraph-' + counter; ++counter; $(this).addClass(uniq); });
source share