# Javascript: SectionCollection.getItem Method

> Gets the section at the current input position or or the section in the collection with the given number.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: SectionCollection.getItem Method
- **400 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/sectioncollection/getitem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/sectioncollection/getitem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/sectioncollection/getitem-method/llms-full.txt

---

### Description

Gets the section at the current input position or or the section in the collection with the given number.

### Syntax

```javascript
<void> SectionCollection.getItem(<RequestSectionCallback> callback, [<number> number], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the section. |
| number | Optional. The section number. The first section has the number 1. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `SectionCollection.getItem` in a practical document-editing workflow. It gets the section at the current input position or or the section in the collection with the given number.

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

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

---

## Nearby

- **Previous:** [Javascript: SectionCollection.addAtTextPosition Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/sectioncollection/addattextposition-method/llms-full.txt)
- **Next:** [SectionFormat Object](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/sectionformat/llms-full.txt)
