# Javascript: TextFrame.activate Method

> Activates the text frame. The text frame receives the input focus. A text frame can only be activated, if the text part that contains the text frame has the input focus.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TextFrame.activate Method
- **423 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textframe/activate-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textframe/activate-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textframe/activate-method/llms-full.txt

---

### Description

Activates the text frame. The text frame receives the input focus. A text frame can only be activated, if the text part that contains the text frame has the input focus.

### Syntax

```javascript
<void> TextFrame.activate([<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Optional. Receives whether the text frame could be activated. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TextFrame.activate` in a practical document-editing workflow. It activates the text frame. The text frame receives the input focus. A text frame can only be activated, if the text part that contains the text frame has the input focus.

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

function activate(textFrame) {
    textFrame.activate(
        function(result) {
            if (result) {
                console.log("activate is available.");
            } else {
                console.warn("activate is not available in the current document state.");
            }
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [TextFrame Object](https://docs.textcontrol.com/ds-server/reference/javascript/textframe/llms-full.txt)
- **Next:** [Javascript: TextFrame.changeZOrder Method](https://docs.textcontrol.com/ds-server/reference/javascript/textframe/changezorder-method/llms-full.txt)
