0
//Example:
var elem = document.querySelector('unique_id');
//assuming no ID or unique characteric:

functionName(elem); //or $.functionName
//name or create this function

//returns:
//  "document.divNameOrId.divNameIfNoId.testParagraph.spanElem" 
//    or
//  something like: document[0][1][5][3]

Please, Name functionName() or $.functionName or Define functionName() or $.functionName.

PrototypeJS answers are not preferred but they are welcome :)

1 Answers1

0

This looks to be answered before but a recursive method would do the trick. See the getPathTo(element) method of this answer to a different question.

Community
  • 1
  • 1