# Javascript: HypertextLinkCollection.getItem Method

> Gets the hypertext link with the specified id.

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

---

### Description

Gets the hypertext link with the specified id.

### Syntax

```javascript
<void> HypertextLinkCollection.getItem(<RequestHypertextLinkCallback> callback, [<ErrorCallback> errorCallback], [<number> id])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the hypertext link. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| id | Optional. Specifies the document link's identifier set with the ID property. The method returns null if a link with the specified identifier does not exist. |

### Examples

The following example demonstrates `HypertextLinkCollection.getItem` in a practical document-editing workflow. It gets the hypertext link with the specified id.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const hypertextLinks = mainText.hypertextLinks;
    hypertextLinks.getItem(
        function(result) {
            if (!result) {
                console.warn("No hypertext link was returned.");
                return;
            }
            
            console.log("get item result:", result);
        },
        onTxError,
        25
    );
}, onTxError);
```

---

## Nearby

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