# Javascript: TrackedChange.setActive Method

> Sets a value specifying whether the TrackedChange is currently active or not.

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

---

### Description

Sets a value specifying whether the TrackedChange is currently active or not.

### Syntax

```javascript
<void> TrackedChange.setActive(<boolean> active, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| active | Specifies whether the TrackedChange is currently active or not. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TrackedChange.setActive` in a practical document-editing workflow. It sets a value specifying whether the TrackedChange is currently active or not.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const trackedChanges = mainText.trackedChanges;
    trackedChanges.getItem(function(trackedChange) {
        if (!trackedChange) {
            console.warn("No tracked change is available at the current input position.");
            return;
        }
    
        trackedChange.setActive(
            true,
            function() {
                console.log("set active completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: TrackedChange.save Method](https://docs.textcontrol.com/ds-server/reference/javascript/trackedchange/save-method/llms-full.txt)
- **Next:** [Javascript: TrackedChange.setHighlightColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/trackedchange/sethighlightcolor-method/llms-full.txt)
