# Javascript: BarcodeCollection.getItem Method

> Gets the barcode selected by the user or the barcode with the specified identifier.

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

---

### Description

Gets the barcode selected by the user or the barcode with the specified identifier.

### Syntax

```javascript
<void> BarcodeCollection.getItem(<RequestBarcodeFrameCallback> callback, [<ErrorCallback> errorCallback], [<number> id])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the requested barcode or null if there is no barcode at the current input position / with the specified identifier. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| id | Optional. The barcode's identifier. |

### Examples

The following example demonstrates `BarcodeCollection.getItem` in a practical document-editing workflow. It gets the barcode selected by the user or the barcode with the specified identifier.

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

TXTextControl.barcodes.getItem(
    function(barcodeFrame) {
        if (!barcodeFrame) {
            console.warn("No barcode frame was returned.");
            return;
        }
        
        console.log("get item result:", barcodeFrame);
    },
    onTxError,
    25
);
```

---

## Nearby

- **Previous:** [Javascript: BarcodeCollection.addWithMouse Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcodecollection/addwithmouse-method/llms-full.txt)
- **Next:** [Javascript: BarcodeCollection.getItemByName Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/barcodecollection/getitembyname-method/llms-full.txt)
