{"id":581,"date":"2013-10-19T00:54:47","date_gmt":"2013-10-18T19:24:47","guid":{"rendered":"http:\/\/www.prasadk.com\/my-press\/?p=581"},"modified":"2013-10-19T01:00:29","modified_gmt":"2013-10-18T19:30:29","slug":"eq-selector-an-jquery-api-documentation-eq-selector-tutorial","status":"publish","type":"post","link":"https:\/\/www.prasadk.com\/my-press\/eq-selector-an-jquery-api-documentation-eq-selector-tutorial\/","title":{"rendered":":eq() Selector an jQuery API Documentation \/ eq() Selector"},"content":{"rendered":"<h2><strong style=\"font-size: 13px;\">:eq() Selector<\/strong><span style=\"font-size: 13px;\"> :\u00a0It\u00a0Select the element at index n\u00a0within the matched set.<\/span><\/h2>\n<p><strong>jQuery( &#8220;:eq(index)&#8221; ) :-<\/strong> index:\u00a0Zero-based index of the element to match.<\/p>\n<p><strong>jQuery( &#8220;:eq(-index)&#8221; ) :- \u00a0 \u00a0<\/strong>\u00a0<strong>-index:\u00a0<\/strong>Zero-based index of the element to match, counting backwards from the last element.<\/p>\n<p>jQuery <strong>eq() selecto<\/strong>r is the index-related selectors (<code>:eq()<\/code>,\u00a0<code>:lt()<\/code>,\u00a0<code>:gt()<\/code>,\u00a0<code>:even<\/code>) filter the set of elements that have matched the expressions that precede them. They narrow the set down based on the order of the elements within this matched set. For example, if elements are first selected with a class selector (<code>.myclass<\/code>) and four elements are returned, these elements are given indices\u00a0<code>0<\/code>\u00a0through\u00a0<code>3<\/code>\u00a0for the purposes of these selectors.<\/p>\n<p>Note that since JavaScript arrays use\u00a0<em>0-based indexing<\/em>, these selectors reflect that fact. This is why<code>$( \".myclass:eq(2)\" )<\/code>\u00a0selects the second element in the document with the class myclass, rather than the first. In contrast,\u00a0<code>:nth-child(n)<\/code>\u00a0uses\u00a0<em>1-based indexing<\/em>\u00a0to conform to the CSS specification.<\/p>\n<p>Prior to jQuery 1.8, the\u00a0<code>:eq(index)<\/code>\u00a0selector did\u00a0<em>not<\/em>\u00a0accept a negative value for\u00a0<code>index<\/code><\/p>\n<p>Example :\u00a0$( &#8220;ul.nav &gt; li:eq( 2 )&#8221; ).addClass( &#8220;myClass&#8221; );<\/p>\n","protected":false},"excerpt":{"rendered":"<p>:eq() Selector :\u00a0It\u00a0Select the element at index n\u00a0within the matched set. jQuery( &#8220;:eq(index)&#8221; ) :- index:\u00a0Zero-based index of the element to match. jQuery( &#8220;:eq(-index)&#8221; ) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0},"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/posts\/581"}],"collection":[{"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/comments?post=581"}],"version-history":[{"count":5,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/posts\/581\/revisions"}],"predecessor-version":[{"id":586,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/posts\/581\/revisions\/586"}],"wp:attachment":[{"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/media?parent=581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/categories?post=581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/tags?post=581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}