Here’s a simple code:
var elements = $('#myDiv').find('a');
Let’s say elements array contains 5 links. Now I want to hide the zeroeth link in the array like this:
$(elements[0]).css("display","none");
I know that $(elements[0]) is illegal. I could say:
var selector="#"+elements[0].id
and then
$(selector).css("display","none");
But how can I reference that element if no id is assigned to it?
It is better to apply special selectors here. To get the first element use
:firstselector:or
:eq()selector:where
:eq(0)selects the element with index 0.