example:
$("td:eq(2)").css("color", "red"); or
$('td').eq(2).css("color", "red");
I want to know what the abbreviation "eq" stands for, I am not asking what the .eq() method does, which can be found here.
Regarding the importance of the question: I myself find it easier to learn a language, when I know what certain abbreviations really stand for. And I also sometimes "read" my written code aloud using "real" words.
I have always assumed that .eq()
is short for "equals." Many (perhaps even most) common English-language words that start with "eq" have the equi- prefix, rooted in the Latin word for "equals."
eq()
makes sense if you know it's part of a related set of selectors (from the JQuery docs):
The index-related selectors (:eq()
, :lt()
, :gt()
, :even
, :odd
) filter
the set of elements that have matched the expressions that precede
them.
When lined up next to lt
(less than), and gt
(greater than), it's clear that it means equals, specifically "index equals n".
I think of it as *e*lement *q*ueue.
i always think eq
is short of sequence
:)