# Javascript: InlineStyleCollection.getItem Method

> Gets a style from the collection by the style's name.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: InlineStyleCollection.getItem Method
- **387 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/inlinestylecollection/getitem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/inlinestylecollection/getitem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/inlinestylecollection/getitem-method/llms-full.txt

---

### Description

Gets a style from the collection by the style's name.

### Syntax

```javascript
<void> InlineStyleCollection.getItem(<String> styleName, <RequestInlineStyleCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| styleName | Specifies the style's name. |
| callback | Receives the style if available. Otherwise null. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `InlineStyleCollection.getItem` in a practical document-editing workflow. It gets a style from the collection by the style's name.

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

TXTextControl.inlineStyles.getItem(
    "Heading 1",
    function(style) {
        if (!style) {
            console.warn("No inline style was returned.");
            return;
        }
        
        console.log("get item result:", style);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: InlineStyleCollection.add Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/inlinestylecollection/add-method/llms-full.txt)
- **Next:** [InputFormat Object](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/inputformat/llms-full.txt)
