# HypertextLink Object

> The HypertextLink object represents a hypertext link in a document that points to a target outside of the document.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > HypertextLink Object
- **2008 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/hypertextlink/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/hypertextlink/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/hypertextlink/llms-full.txt

---

### Description

The HypertextLink object represents a hypertext link in a document that points to a target outside of the document.

### Syntax

```javascript
HypertextLink
```

### Examples

The following example demonstrates `HypertextLink` in a practical document-editing workflow. The HypertextLink object represents a hypertext link in a document that points to a target outside of the document.

```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(hypertextLink) {
        if (!hypertextLink) {
            console.warn("No hypertext link is available at the current input position.");
            return;
        }
    
        hypertextLink.getDescriptiveText(
            function(result) {
                console.log("get descriptive text result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## In This Section

- [Javascript: HypertextLink.getDescriptiveText Method](https://docs.textcontrol.com/ds-server/reference/javascript/hypertextlink/getdescriptivetext-method/llms-full.txt): Gets the hyperlink's descriptive text. An empty string indicates that the link has no such text.
- [Javascript: HypertextLink.getTarget Method](https://docs.textcontrol.com/ds-server/reference/javascript/hypertextlink/gettarget-method/llms-full.txt): Gets a string that specifies the target to where the hypertext link points.
- [Javascript: HypertextLink.setDescriptiveText Method](https://docs.textcontrol.com/ds-server/reference/javascript/hypertextlink/setdescriptivetext-method/llms-full.txt): Sets the hyperlink's descriptive text. An empty string or null can be used to delete a previously set text.
- [Javascript: HypertextLink.setTarget Method](https://docs.textcontrol.com/ds-server/reference/javascript/hypertextlink/settarget-method/llms-full.txt): Sets a string that specifies the target to where the hypertext link points.

---

## Nearby

- **Previous:** [Javascript: HyperLinkInfo.target Property](https://docs.textcontrol.com/ds-server/reference/javascript/hyperlinkinfo/target-property/llms-full.txt)
- **Next:** [Javascript: HypertextLink.getDescriptiveText Method](https://docs.textcontrol.com/ds-server/reference/javascript/hypertextlink/getdescriptivetext-method/llms-full.txt)
