# Javascript: HeaderFooter.getConnectedToPrevious Method

> Gets a value specifying whether the header or footer is connected with the header or footer of the previous section. If headers or footers are connected, they have always the same contents.

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

---

### Description

Gets a value specifying whether the header or footer is connected with the header or footer of the previous section. If headers or footers are connected, they have always the same contents.

### Syntax

```javascript
<void> HeaderFooter.getConnectedToPrevious(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives whether the header or footer is connected with the header or footer of the previous section. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `HeaderFooter.getConnectedToPrevious` in a practical document-editing workflow. It gets a value specifying whether the header or footer is connected with the header or footer of the previous section. If headers or footers are connected, they have always the same contents.

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

function inspectConnectedToPrevious(headerFooter) {
    headerFooter.getConnectedToPrevious(
        function(result) {
            if (result) {
                console.log("get connected to previous is available.");
            } else {
                console.warn("get connected to previous is not available in the current document state.");
            }
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: HeaderFooter.deactivate Method](https://docs.textcontrol.com/ds-server/reference/javascript/headerfooter/deactivate-method/llms-full.txt)
- **Next:** [Javascript: HeaderFooter.getDistance Method](https://docs.textcontrol.com/ds-server/reference/javascript/headerfooter/getdistance-method/llms-full.txt)
