.getChildren( [ immediate ] ) - Get all child elements or immediate children
.getChildren() will fetch all or only immediate child elements and wrap them into Nedil Objects.
Parameters
NameTypeDefaultPossible ValuesDescription
immediateBooleanfalsetrue / falseSetting this to true, will fetch only the direct (immediate) child elements, else will fetch all children
Returns
NameTypeDescription
Child Elements$.ObjsReturns all the child elements wrapped to Nedil Objects
Example 1
.getChildren() gets all the children of #parent and returns as Nedil Objects. Using Chil Nedil Onjects, we style the background color of children. "style" function is explained under Utilities.
JS HTML CSS
		$.domLoaded(function() {

			$.get("#change").on("click", function() {
			
				//get all children
				var chil = $.get("#parent").getChildren();
				
				chil.style("background-color", "red");

			});
			
		});						
						
<body>

<div id="parent"> 
Parent
	<div class="child">child</div>
	<div class="child">child
		<div class="child"> Sub Child</div>
		<div class="child"> Sub Child</div>
	</div>
	<div class="child">child</div>

</div>
<br/>
<input type="button" id="change" value="Get #parent's all children and change color" />

</body>
			#parent {
			display : inline-block;
			background-color : #fff;
			border : 2px solid red;
			padding : 10px;
		}
		
		.child {
			padding : 10px;
			margin : 5px;
			background-color : #0af;
			border : 2px solid #000;
		}
		
		
Result
Example 2
.getChildren() can also be used to fetch only the immediate (direct) children. Following example takes only the immediate children of #parent and changes their background color.
JS HTML CSS
		$.domLoaded(function() {

			$.get("#change").on("click", function() {
			
				//get only immediate children
				var chil = $.get("#parent").getChildren(true);
				
				chil.style("background-color", "red");
				
				
			});
			
		});						
						
<body>

<div id="parent"> 
Parent
	<div class="child">child</div>
	<div class="child">child
		<div class="child"> Sub Child</div>
		<div class="child"> Sub Child</div>
	</div>
	<div class="child">child</div>

</div>
<br/>
<input type="button" id="change" value="Get #parent's immediate children and change color" />

</body>
				#parent {
			display : inline-block;
			background-color : #fff;
			border : 2px solid red;
			padding : 10px;
		}
		
		.child {
			padding : 10px;
			margin : 5px;
			background-color : #0af;
			border : 2px solid #000;
		}
		
		
Result