control-freak-ide/Control-Freak-Documentation/jQuery/docs/entries/gt-selector.json
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

1 line
2.1 KiB
JSON

{"name":"gt","type":"selector","title":":gt() Selector","deprecated":null,"removed":null,"desc":"Select all elements at an index greater than <code>index</code> within the matched set.","categories":["selectors/basic-filter-selectors","selectors/jquery-selector-extensions","version/1.0"],"entries":[{"return":"","signatures":[{"sample":":gt(index)","added":"1.0","argument":{"desc":"Zero-based index.","name":"index","type":"Number"}},{"sample":":gt(-index)","added":"1.8","argument":{"desc":"Zero-based index, counting backwards from the last element. ","name":"-index","type":"Integer"}}],"examples":{"desc":"Give TD #5 and higher a yellow background and TD #8 a red text color.","code":"\n$( \"td:gt(4)\" ).css( \"backgroundColor\", \"yellow\" );\n$( \"td:gt(-2)\" ).css( \"color\", \"red\" );\n","html":"\n<table border=\"1\">\n <tr><td>TD #0</td><td>TD #1</td><td>TD #2</td></tr>\n <tr><td>TD #3</td><td>TD #4</td><td>TD #5</td></tr>\n <tr><td>TD #6</td><td>TD #7</td><td>TD #8</td></tr>\n</table>\n"},"longdesc":"\n <p>\n <strong>index-related selectors</strong>\n </p>\n <p>The index-related selector expressions (including this \"greater than\" selector) 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 0 through 3 for the purposes of these selectors.</p>\n <p>Note that since JavaScript arrays use <em>0-based indexing</em>, these selectors reflect that fact. This is why <code>$( \".myclass:gt(1)\" )</code> selects elements after the second element in the document with the class <code>myclass</code>, rather than after the first. In contrast, <code>:nth-child(n)</code> uses <em>1-based indexing</em> to conform to the CSS specification.</p>\n <p>Prior to jQuery 1.8, the <code>:gt(index)</code> selector did <em>not</em> accept a negative value for <code>index</code></p>\n "}],"slug":"gt-selector"}