$(document).one('click', function(event) {
var i=100, arr = [], current = $(event.target);
while(i-- > 0 && current[0].nodeName.toLowerCase() !== 'body') {
arr.push(
(current.attr('id') && "#"+current.attr('id'))
|| (current.attr('class') && current[0].nodeName.toLowerCase() +"."+current.attr('class'))
|| (current[0].nodeName.toLowerCase() + ":eq(" + current.index() + ")"));
current = current.parent();
}
console.log(arr.reverse().join(' '));
});