# Javascript: TableOfContents.update Method

> Updates the content and the page numbers of the table of contents.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 29.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: TableOfContents.update Method
- **383 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontents/update-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontents/update-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontents/update-method/llms-full.txt

---

### Description

Updates the content and the page numbers of the table of contents.

### Syntax

```javascript
<void> TableOfContents.update(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives whether the call was succesful. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TableOfContents.update` in a practical document-editing workflow. It updates the content and the page numbers of the table of contents.

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

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

---

## Nearby

- **Previous:** [Javascript: TableOfContents.setTitle Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontents/settitle-method/llms-full.txt)
- **Next:** [TableOfContentsCallback Function](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tableofcontentscallback/llms-full.txt)
