How to get all element parents using jquery? i want to save these parents in a variable so i can use later as a selector.
such as <div><a><img id='myImg'/></a></div>
GetParents(‘myImg’); will return ‘div a’ something like that
How to get all element parents using jquery? i want to save these parents
Share
/// Get an array of all the elements parents:
/// Get the nested selector through an element’s parents:
GetParents(‘myImage’) will return your nested selector: HTML BODY DIV A #myImage
Note sure why you’d want this but its reuseable as a selector.