# Javascript: HypertextLinkCollection.remove Method

> Removes a hypertext link from a Text Control document.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: HypertextLinkCollection.remove Method
- **525 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/hypertextlinkcollection/remove-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/hypertextlinkcollection/remove-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/hypertextlinkcollection/remove-method/llms-full.txt

---

### Description

Removes a hypertext link from a Text Control document.

### Syntax

```javascript
<void> HypertextLinkCollection.remove(<HypertextLink> HypertextLink, <boolean> keepText, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| HypertextLink | Specifies the hypertext link to remove. |
| keepText | If this parameter is set to true, the hypertext link is removed without deleting its text. Otherwise, the link's text is also deleted. |
| callback | Optional. Receives whether the remove was succesful. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `HypertextLinkCollection.remove` in a practical document-editing workflow. It removes a hypertext link from a Text Control document.

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

function remove(HypertextLink) {
    TXTextControl.textParts.getMainText(function(mainText) {
        const hypertextLinks = mainText.hypertextLinks;
        hypertextLinks.remove(
            HypertextLink,
            true,
            function(result) {
                if (result) {
                    console.log("remove is available.");
                } else {
                    console.warn("remove is not available in the current document state.");
                }
            },
            onTxError
        );
    }, onTxError);
}
```

---

## Nearby

- **Previous:** [Javascript: HypertextLinkCollection.getItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/hypertextlinkcollection/getitem-method/llms-full.txt)
- **Next:** [HypertextLinkEventArgs Object](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/hypertextlinkeventargs/llms-full.txt)
