---
title: getElementsById
---

```php
getElementsById ( string $id [, int $idx = null ] ) : object
```

Searches elements by id.

| Parameter | Description
| --------- | -----------
| `id`      | ID of the element to find.
| `idx`     | Returns the element at the specified index if defined.

Returns the element(s) or null if no match was found.