(function($){$.fn.xpath=function(){ var el=this;for(var e=””,c=$_(el)[0];c&&c.nodeType==1;c=c.parentNode){var b=$_(c.parentNode).children(c.tagName).index(c)+1;b>1?(b=”["+b+"]“):(b=””);e=”/”+c.tagName.toLowerCase()+b+e;}return e;};})(jQuery);
Using this, I can reference the xPath of any element on a page by calling $(“#SomeElement”).xpath();
Thanks