# Javascript: Selection.getUnderline Method

> Gets the underlining styles of the selected text.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 26.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: Selection.getUnderline Method
- **351 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/getunderline-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/getunderline-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/getunderline-method/llms-full.txt

---

### Description

Gets the underlining styles of the selected text.

### Syntax

```javascript
<void> Selection.getUnderline(<RequestFontUnderlineStyleCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the underlining styles of the selected text. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `Selection.getUnderline` in a practical document-editing workflow. It gets the underlining styles of the selected text.

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

TXTextControl.selection.getUnderline(
    function(result) {
        if (!result) {
            console.warn("No font underline style was returned.");
            return;
        }
        
        console.log("get underline result:", result);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: Selection.getTextBackColor Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/gettextbackcolor-method/llms-full.txt)
- **Next:** [Javascript: Selection.growFont Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/selection/growfont-method/llms-full.txt)
