Home >Web Front-end >Front-end Q&A >What is jquery's gt?

What is jquery's gt?

青灯夜游
青灯夜游Original
2021-11-15 14:12:324058browse

gt in jquery is a filter selector, used to obtain all elements greater than a given index (index) value, the syntax is "$(":gt(index)")"; this selector is commonly used Used with other selectors to select elements after a specific sequence number in a specified combination.

What is jquery's gt?

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

"gt" is a filter selector in jquery, the full name is ":gt()".

:gt() selector gets all elements that are greater than the given index (index) value, and the index number starts from 0.

Syntax:

$(":gt(index)")

index Required. Specifies the elements to be selected. Elements whose index value is greater than the specified number will be selected.

: The most common use of the gt() selector: used with other selectors to select elements after a specific sequence number in a specified combination (such as the example above).

Example:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<script src="jquery-1.10.2.min.js"></script>
</head>
<body> 
  
    <table style="width:100%" border="3"> 
        <tr> 
            <td>0</td> 
            <td>1</td> 
            <td>2</td> 
            <td>3</td> 
            <td>4</td> 
        </tr> 
        <tr> 
            <td>5</td> 
            <td>6</td> 
            <td>7</td> 
            <td>8</td> 
            <td>9</td> 
        </tr> 
        <tr> 
            <td>10</td> 
            <td>11</td> 
            <td>12</td> 
            <td>13</td> 
            <td>14</td> 
        </tr> 
    </table> 
  
    <script> 
        $("td:gt(8)").css( 
          "backgroundColor", "lightgreen"); 
  
        $("td:gt(3)").css( 
          "color", "red"); 
    </script> 
  
</body> 
  
</html>

What is jquerys gt?

Related video tutorial recommendation: jQuery Tutorial(Video)

The above is the detailed content of What is jquery's gt?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn