Reputation: 6929
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.
Upvotes: 47
Views: 8596
Reputation: 11461
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".
Upvotes: 68
Reputation: 359956
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."
Upvotes: 22