# Chained Target

We are used to nested querying in JavaScript e.g. `document.querySelector("#foo").querySelector("#bar")`. Similarly you can chain targets in Puppetry.

Let's say we have a target `LEVEL_1`:

![Defining parent target](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuI0cO52QNTtp2SkV7k%2F-LuI0iRRsMTlJP78TeLI%2Fchained1.png?alt=media\&token=844db365-b8b1-43cb-af25-e97244de1ffa)

If we want to have a child target we use **Options** link

![Defining local target](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuI0cO52QNTtp2SkV7k%2F-LuI0kJLmPhNdsxMvNx5%2Fchained2.png?alt=media\&token=3055af09-a437-404e-81bb-ea54f12f6185)

We set **Parent target** to `LEVEL_1` and **Parent type** to `generic element`.

![Chained target](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuI0cO52QNTtp2SkV7k%2F-LuI0mFGw7OPv7TyG41k%2Fchained3.png?alt=media\&token=2bbb2c72-1d29-4808-80e7-1a8dff295f08)

As soon as the `LEVEL_2` target defined we can address it as any simple target.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.puppetry.app/target/chained-target.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
