Skip to content Skip to sidebar Skip to footer

Depth Property In Js?

lets say i have this html code :
my question : is there any js property which exposes eleme

Solution 1:

You could do this:

$('#a').first().parents().length

Edited as per zzzzBov's comment.

Solution 2:

Is there any js property which exposes element's depth?

Not built-in, no. You could always make one using defineGetter and defineSetter.

Post a Comment for "Depth Property In Js?"