# Javascript: PageCollection.getItem Method

> Gets the Page containing the current text input position from the collection.

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

---

### Description

Gets the Page containing the current text input position from the collection.

### Syntax

```javascript
<void> PageCollection.getItem(<RequestPageCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the page at the current text input position. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `PageCollection.getItem` in a practical document-editing workflow. It gets the Page containing the current text input position from the collection.

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

TXTextControl.pages.getItem(
    function(page) {
        if (!page) {
            console.warn("No page was returned.");
            return;
        }
        
        console.log("get item result:", page);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [PageCollection Object](https://docs.textcontrol.com/ds-server/reference/javascript/pagecollection/llms-full.txt)
- **Next:** [Javascript: PageCollection.getItemAtTextPosition Method](https://docs.textcontrol.com/ds-server/reference/javascript/pagecollection/getitemattextposition-method/llms-full.txt)
