# Javascript: TextFieldCollection.remove Method

> Removes the text field from the Text Control document.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TextFieldCollection.remove Method
- **399 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textfieldcollection/remove-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textfieldcollection/remove-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textfieldcollection/remove-method/llms-full.txt

---

### Description

Removes the text field from the Text Control document.

### Syntax

```javascript
<void> TextFieldCollection.remove(<TextField> textField, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| textField | Specifies the text field to remove. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TextFieldCollection.remove` in a practical document-editing workflow. It removes the text field from the Text Control document.

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

function remove(textField) {
    TXTextControl.textParts.getMainText(function(mainText) {
        const textFields = mainText.textFields;
        textFields.remove(
            textField,
            function() {
                console.log("remove completed.");
            },
            onTxError
        );
    }, onTxError);
}
```

---

## Nearby

- **Previous:** [Javascript: TextFieldCollection.getItem Method](https://docs.textcontrol.com/ds-server/reference/javascript/textfieldcollection/getitem-method/llms-full.txt)
- **Next:** [TextFieldCollectionBase Object](https://docs.textcontrol.com/ds-server/reference/javascript/textfieldcollectionbase/llms-full.txt)
