reference[0] refers to an Element instead of a jQuery object.
If you want to refer to the first object matching a selector, use .first():
/* This returns a jQuery object. */
reference.first();
If you want the object at index n, use ':eq(n)' in your selector, or the eq() method. These are zero-indexed:
/* This returns a jQuery object. */
$('.class:eq(n)');
/* This returns a jQuery object. */
reference.eq(n);
You could also "re-wrap" an element, but this is not idiomatic:
/* This returns an Element. */
reference[n];
/* This returns a jQuery object. */
$(reference[n]);
Similarly, you could use get. But the methods above are preferable:
/* This returns an Element. */
reference.get(n);
/* This returns a jQuery object. */
$(reference.get(n));
What wrapping means:
This is our page:
<!DOCTYPE html>
<html>
<head>
<title>Hey</title>
</head>
<body>
<p>You</p>
<p>!!!</p>
</body>
</html>
This creates a jQuery object named $p, selecting the two <p> Elements:
/* This returns a jQuery object. */
var $p = $('p');
This object has all those useful jQuery methods we love:
$p.css('color', 'purple'); /* this colors all paragraphs purple */
Like I said, we can select the second (or first) paragraph with .eq():
/* This returns a jQuery object. */
$p.eq(1); /* this selects the second paragraph (because indices start at 0) */
Or we could do it like you were trying to do:
/* This returns an Element. */
$p[1];
But this gives us a plain old Element, and not a jQuery object. However, if we apply the jQuery function, we get back a jQuery object, and we can use all our beloved jQuery methods:
$($p[1]).text('???');
Applying $ again to an Element is what I called re-wrapping.
.eq( index )to create a jQuery object containing a single element, is that what you want?