# Javascript: TXTextControl.selection Property

> Returns the current selection or sets the selection's position and length. The setter must be used as follows: TXTextControl.selection = { start: 2, length: 5 }

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 24.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TXTextControl.selection Property
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/selection-property/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/selection-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/selection-property/llms-full.txt

---

## On This Page

- [Description](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/selection-property/#description)
- [Syntax](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/selection-property/#syntax)
- [Examples](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/selection-property/#examples)

---

## Nearby

- **Previous:** [Javascript: TXTextControl.selectAll Method](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/selectall-method/llms.txt)
- **Next:** [Javascript: TXTextControl.selectWord Method](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/selectword-method/llms.txt)
