# Javascript: InputFormat.getStyleName Method

> Gets the formatting style name at the current input position.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: InputFormat.getStyleName Method
- **305 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/inputformat/getstylename-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/inputformat/getstylename-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/inputformat/getstylename-method/llms-full.txt

---

### Description

Gets the formatting style name at the current input position.

### Syntax

```javascript
<void> InputFormat.getStyleName(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the formatting style name at the current input position. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `InputFormat.getStyleName` in a practical document-editing workflow. It gets the formatting style name at the current input position.

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

TXTextControl.inputFormat.getStyleName(
    function(result) {
        console.log("get style name result:", result);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: InputFormat.getStructureLevel Method](https://docs.textcontrol.com/ds-server/reference/javascript/inputformat/getstructurelevel-method/llms-full.txt)
- **Next:** [Javascript: InputFormat.getStyleNames Method](https://docs.textcontrol.com/ds-server/reference/javascript/inputformat/getstylenames-method/llms-full.txt)
