Computer Magic Logo
Tag in a tag selector

Thursday, January 12, 2017

Published by Aristotelis Pitaridis

Sometimes we want to select all the element tags which are inside another element tag. The following example demonstrates how to select all tr elements that are descendants of the table element. Descendants are children, grandchildren, etc of the designated ancestor element.

var elements = $('table tr');