You could do this:
$('#a').first().parents().length
Edited as per zzzzBov's comment.
Is there any js property which exposes element's depth?
Not built-in, no. You could always make one using defineGetter
and defineSetter
.
You may like these posts
Post a Comment for "Depth Property In Js?"