I am using the following to get a list of DIVS;
var $items = $this.children("div.poster");
How can I get the element in position 4 from $items if it exists?
I am using the following to get a list of DIVS;
var $items = $this.children("div.poster");
How can I get the element in position 4 from $items if it exists?
Use the .eq()
method:
var $item4 = $items.eq(3);
To get the position of an item, use .index()
var position = $item4.index($items);