# RequestHighlightModeCallback Function

> Callback function for requesting a highlighting mode.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Function
- **Path:** DS Server > Reference > JavaScript API > RequestHighlightModeCallback Function
- **368 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/requesthighlightmodecallback/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/requesthighlightmodecallback/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/requesthighlightmodecallback/llms-full.txt

---

### Description

Callback function for requesting a [highlighting mode](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/highlightmode-enumeration/llms-full.txt).

### Syntax

```javascript
function(<HighlightMode> result)
```

### Examples

The following example demonstrates `RequestHighlightModeCallback` in a practical document-editing workflow. Callback function for requesting a highlighting mode.

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

function requestHighlightModeCallback(result) {
    console.log("result:", result);
}

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.getHighlightMode(requestHighlightModeCallback, onTxError);
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [RequestHeaderFooterTypeCallback Function](https://docs.textcontrol.com/ds-server/reference/javascript/requestheaderfootertypecallback/llms-full.txt)
- **Next:** [RequestHorizontalAlignmentCallback Function](https://docs.textcontrol.com/ds-server/reference/javascript/requesthorizontalalignmentcallback/llms-full.txt)
