{"name":"eq","type":"selector","title":":eq() Selector","deprecated":null,"removed":null,"desc":"Select the element at index n within the matched set.","categories":["selectors/basic-filter-selectors","selectors/jquery-selector-extensions","version/1.0","version/1.8"],"entries":[{"return":"","signatures":[{"sample":":eq(index)","added":"1.0","argument":{"desc":"Zero-based index of the element to match.","name":"index","type":"Number"}},{"sample":":eq(-index)","added":"1.8","argument":{"desc":"Zero-based index of the element to match, counting backwards from the last element. ","name":"-index","type":"Integer"}}],"examples":[{"desc":"Find the third td.","code":"\n$( \"td:eq( 2 )\" ).css( \"color\", \"red\" );\n","html":"\n\n \n \n \n
TD #0TD #1TD #2
TD #3TD #4TD #5
TD #6TD #7TD #8
\n"},{"height":"160","desc":"Apply three different styles to list items to demonstrate that :eq() is designed to select a single element while :nth-child() or :eq() within a looping construct such as .each() can select multiple elements.","code":"\n// Applies yellow background color to a single
  • \n$( \"ul.nav li:eq(1)\" ).css( \"backgroundColor\", \"#ff0\" );\n\n// Applies italics to text of the second
  • within each