# Javascript: Selection.getItalic Method

> Gets the italic attribute of the selected text.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 26.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: Selection.getItalic Method
- **348 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/getitalic-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/getitalic-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/selection/getitalic-method/llms-full.txt

---

### Description

Gets the italic attribute of the selected text.

### Syntax

```javascript
<void> Selection.getItalic(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

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

### Examples

The following example demonstrates `Selection.getItalic` in a practical document-editing workflow. It gets the italic attribute of the selected text.

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

TXTextControl.selection.getItalic(
    function(result) {
        if (result) {
            console.log("get italic is available.");
        } else {
            console.warn("get italic is not available in the current document state.");
        }
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: Selection.getFormattingStyle Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/getformattingstyle-method/llms-full.txt)
- **Next:** [Javascript: Selection.getLength Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/getlength-method/llms-full.txt)
