Returns a QueryCollection with zero or one elements matching the specified selector query.
Syntax
var queryCollection = WinJS.Utilities.query(query, element);
Parameters
- query
-
Type:
The selector to use.
- element
-
Type: DOMElement
Optional. The root element at which to start the query. If this parameter is omitted, the scope of the query is the entire document.
Return value
Type: QueryCollection
A QueryCollection with zero or one elements matching the specified selector query.
Examples
The following code shows two types of queries. The "win-star" class is added to the elements that represent the stars of the rating.
<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.query(".win-star"); var y = children.length; children = WinJS.Utilities.query("#ratingDiv"); y = children.length; </script>
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
WinJS.Utilities |
|
Library |
|
Build date: 12/5/2012