getByIndex function

Get element by index.