# Javascript: Selection.removeFormatting Method

> Resets all character based formatting attributes of the selected text to its default values. If nothing or more than one paragraph is selected, all paragraph based formatting attributes are also reset.

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

---

### Description

Resets all character based formatting attributes of the selected text to its default values. If nothing or more than one paragraph is selected, all paragraph based formatting attributes are also reset.

### Syntax

```javascript
<void> Selection.removeFormatting([<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `Selection.removeFormatting` in a practical document-editing workflow. Resets all character based formatting attributes of the selected text to its default values. If nothing or more than one paragraph is selected, all paragraph based formatting attributes are also reset.

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

TXTextControl.selection.removeFormatting(
    function() {
        console.log("remove formatting completed.");
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: Selection.paragraphFormat Property](https://docs.textcontrol.com/ds-server/reference/javascript/selection/paragraphformat-property/llms-full.txt)
- **Next:** [Javascript: Selection.removeInlineStyles Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/removeinlinestyles-method/llms-full.txt)
