For the following project I will be using PHP and jQuery.
I have the following code:
$(\'*\').onclick(function(){
});
Once a user
a fix to Gaby aka G. Petrioli
added "nd" to children
.children(nd)
full:
$(document).delegate('*','click',function(){
var path = $(this).parents().andSelf();
var xpath=''; // firebug xpath starts with '/html'
for (var i = 0; i < path.length; i++) {
var nd = path[i].nodeName.toLowerCase();
if (nd =="tbody") continue; // php DOMxpath ignores tbody? or browser fixes html?
xpath += '/';
if (nd != 'html' && nd != 'body')
{xpath += nd+'['+ ($(path[i-1]).children(nd).index(path[i])+1) +']';} //! saving time ha?
else
{xpath += nd;}
}
alert(xpath);
return false;
});