Windows Dev Center

WinJS.Utilities.children function

Applies to Windows and Windows Phone

Gets a collection of elements that are the direct children of the specified element.

Syntax


var queryCollection = WinJS.Utilities.children(element);

Parameters

element

Type: DOMElement

The parent element

Return value

Type: QueryCollection

The collection of children of the element.

Examples

The following code shows how to use this function.


<div id="ratingDiv" data-win-control="WinJS.UI.Rating"></div>
<script type="text/javascript">
     WinJS.UI.processAll();
     var div = document.getElementById("ratingDiv");

     var children = WinJS.Utilities.children(div);

     var i = 0;
     while (i < children.length) {
         var child = children[i++];
         if (WinJS.Utilities.hasClass(child, "win-star")) {
             var rating = WinJS.Utilities.data(child);
             var y = rating.msStarRating;
         }
     }
</script>

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1

Namespace

WinJS.Utilities

Library

Winjs.js

 

 

Show:
© 2015 Microsoft