Get element from selector given an index with jQuery

indexing, jquery, jquery-selectors

Solution

Try this:

items.eq(2) // gets the third element as a jQuery object (zero-based index)

Source: http://docs.jquery.com/Traversing/eq#index

Problem

``` var items = $(".myClass"); ``` The code above returns a number of items when used to select all elements. How can I select a specific element, for example the second one? Neither `items(2)` nor `items[2]` works.

Original source