Per
https://api.jquery.com/category/selectors/ Child Selector (“parent > child”)
Selects all direct child elements specified by “child” of elements specified by “parent”.
Double check how you are referencing the parent and the children
I grabbed this code from
https://api.jquery.com/child-selector/, modified it and it works. Just remember that multiple elements can have the same css class, but each element must have a
distinct css id.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>child demo</title>
<style>
body {
font-size: 14px;
}
</style>
<script src="
https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<ul class="topnav">
<li>Item 1</li>
<li>Item 2
<ul>
<li>Nested item 1</li>
<li>Nested item 2</li>
<li>Nested item 3</li>
</ul>
</li>
<li>Item 3</li>
</ul>
<ul id="topnav_id">
<li>Item 1</li>
<li>Item 2
<ul>
<li>Nested item 1</li>
<li>Nested item 2</li>
<li>Nested item 3</li>
</ul>
</li>
<li>Item 3</li>
</ul>
<script>
myChildren = $( "ul#topnav_id > li" );
myChildren.css( "border", "3px double blue" );
alert("With id " + myChildren.length);
myChildren = $( "ul.topnav > li" );
myChildren.css( "border", "3px double purple" );
alert("With class " + myChildren.length);
</script>
</body>
</html>
Hope this helps.
Liz