---
agentTools:
  projectIndex: https://x-tag.readme.io/llms.txt
---

# xtag.queryChildren

Query only the direct children of an element with a provided selector

\##`xtag.queryChildren(ELEMENT, SELECTOR)`

[block:parameters]
{
  "data": {
    "h-0": "Argument",
    "h-1": "Type",
    "h-2": "Description",
    "0-0": "ELEMENT",
    "0-1": "DOM element reference",
    "0-2": "A reference to the DOM element you wish to query",
    "1-0": "SELECTOR",
    "1-1": "String",
    "1-2": "The CSS selector string you would like to test for matches against the element's direct children."
  },
  "cols": 3,
  "rows": 2
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "var arrayOfRedLinks = xtag.queryChildren(myElement, 'a.red');\n// Finds all links with the class 'red'",
      "language": "javascript"
    }
  ]
}
[/block]