jQuery: The Write Less, Do More JavaScript Library

 « Return to Thread: :eq versus eq()

Re: :eq versus eq()

by Maujor :: Rate this Message:

| View in Thread

Good point Pierre!
Well noted. TKS.
Any others possible differences?
Maurício
-----Mensagem Original-----
Enviada em: quarta-feira, 10 de junho de 2009 13:25
Assunto: [jQuery] Re: :eq versus eq()

With the traversing method, you can match a set of elements then select, for example, the third one

$('.myclass,#myid').eq(2)

I didn't use the traversing method but i think that is one of possible usage

Pierre

2009/6/10 Maujor <css.maujor@...>


According jQuery documentation  [1][2]
:eq returns Array <Element> and eq() returns one jQuery object.
What does means "Array <Element>"? It is a single element?
By the other hand eq() => "Reduce the set of matched elements to a single
element."
So, both returns a single element and it seems to me that there isn't any
difference between :eq and eq().
Is one faster than the other?
Why are there two sintaxes to achieve the same task? Or am I missing
sometghing?

[1] http://docs.jquery.com/Selectors
[2] http://docs.jquery.com/Traversing

-----
Maurício Samy Silva
--
View this message in context: http://www.nabble.com/%3Aeq-versus-eq%28%29-tp23962849s27240p23962849.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.


Maurício Samy Silva

 « Return to Thread: :eq versus eq()