javascript - Get XPath of a DOM element with jQuery -


i need xpath of dom element persist can element lather.

i've tried getpathto method of this answer when call method jquery-created object this...

getpathto(jquery('h3').first()); 

...i error:

uncaught typeerror: cannot read property 'childnodes' of undefined(…)

i've tried replace parentnode parent(), childnodes children(), , tagname prop('tagname'), received undefined function result...

so, have similar function getpathto works jquery?

the method expects dom node , giving jquery object

getpathto(jquery('h3').first()[0]) 

or

getpathto(jquery('h3').first().get(0)) 

Comments