C.O.
C.O.

Reputation: 2329

jquery how to count all xml nodes of one type with a certain type of parent node

From my XML I'd like to get the number of chaper nodes that are nested in video nodes. Getting the total number of chaper nodes works with

$(xml).find("chapter").length

What is the syntax to add the video parent node requirement?

Upvotes: 0

Views: 382

Answers (1)

loxxy
loxxy

Reputation: 13151

I think you are looking for :

$(xml).find("video > chapter").length

Upvotes: 1

Related Questions