A jQuery object is array-like; you can access elements with brackets,
like $(li)[0]. However, that will return the element. If you want to
use a jQuery method with that element, you need to wrap it with $().
Joseph's second example will work (his first will fail for the same
reason). There are several ways to access an element in a collection,
depending upon which element you want. Martijn's is a good choice if
you only want the first element.

On Mar 9, 4:51 am, Martijn Houtman <martijn.hout...@gmail.com> wrote:
> On Mar 9, 11:53 am, niraj <nirajke...@lucent.com> wrote:
>
> > var li = $('.items');
> > li[0].remove();
>
> $(".items:first").remove();

Reply via email to