# Javascript: Selection.setBounds Method

> Obsolete. This method will be removed in one of the next versions. Sets the selection's start position and length.

> **Note:** This is deprecated and should not be used in new work.

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

---

### Description

`Obsolete. This method will be removed in one of the next versions.` Sets the selection's start position and length.

### Syntax

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

### Parameters

| Parameter | Description |
|---|---|
| bounds | Selection start position and length. |
| 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.setBounds` in a practical document-editing workflow. Obsolete. This method will be removed in one of the next versions. Sets the selection's start position and length.

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

TXTextControl.selection.setBounds(
    { start: 1, length: 5 },
    function() {
        console.log("set bounds completed.");
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: Selection.setBold Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/setbold-method/llms-full.txt)
- **Next:** [Javascript: Selection.setCapitals Method](https://docs.textcontrol.com/ds-server/reference/javascript/selection/setcapitals-method/llms-full.txt)
