# Javascript: SubTextPart.getChildren Method

> Returns an array of the children of this SubTextPart.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 32.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: SubTextPart.getChildren Method
- **484 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/getchildren-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/getchildren-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/getchildren-method/llms-full.txt

---

### Description

Returns an array of the children of this SubTextPart.

### Syntax

```javascript
<void> SubTextPart.getChildren(<RequestSubTextPartsCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the children. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `SubTextPart.getChildren` in a practical document-editing workflow. It returns an array of the children of this SubTextPart.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const subTextParts = mainText.subTextParts;
    subTextParts.getItem(function(subTextPart) {
        if (!subTextPart) {
            console.warn("No sub text part is available at the current input position.");
            return;
        }
    
        subTextPart.getChildren(
            function(subTextParts) {
                if (!subTextParts) {
                    console.warn("No sub text part was returned.");
                    return;
                }
                
                console.log("get children result:", subTextParts);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [SubTextPart Object](https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/llms-full.txt)
- **Next:** [Javascript: SubTextPart.getData Method](https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/getdata-method/llms-full.txt)
