# Javascript: TXTextControl.HighlightMode Enumeration

> Contains all possible highlight mode values.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Enumeration
- **Introduced:** 25.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: TXTextControl.HighlightMode Enumeration
- **442 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/highlightmode-enumeration/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/highlightmode-enumeration/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/highlightmode-enumeration/llms-full.txt

---

### Description

Contains all possible highlight mode values.

### Members

| Member | Description |
|---|---|
| Never | The element is never highlighted. |
| Activated | The element is only highlighted, when it contains the current text input position and when the control has the input focus. |
| Always | The element is always highlighted. |
| Auto | The element's highlight mode is governed by the global highlight mode property. |

### Examples

The following example uses `TXTextControl.HighlightMode.Always` (the element is always highlighted.) in a document-editing workflow.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const comments = mainText.comments;
    comments.getItem(function(commentedText) {
        if (!commentedText) {
            console.warn("No commented text is available at the current input position.");
            return;
        }
    
        commentedText.setHighlightMode(
            TXTextControl.HighlightMode.Always,
            function() {
                console.log("set highlight mode completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.headersAndFooters Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/headersandfooters-property/llms-full.txt)
- **Next:** [Javascript: TXTextControl.HorizontalAlignment Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/horizontalalignment-enumeration/llms-full.txt)
