jquery gt选择器
翻译结果:
gt
n.Guatemala 危地马拉
jquery gt选择器语法
作用::gt 选择器选取 index 值高于指定数的元素。index 值从 0 开始。经常与其他元素/选择器一起使用,来选择指定的组中特定序号之后的元素(如上面的例子)。
语法:$(":gt(index)"
参数:index 必需。规定要选择的元素。会选取 index 值大于指定数的元素。
注释:请使用 :lt 选择器来选取 index 值小于指定数的元素。
jquery gt选择器示例
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("tr:gt(2)").css("background-color","#B2E0FF"); }); </script> </head> <body> <html> <body> <h1>Welcome to My Web Page</h1> <table> <tr> <th>Id</th> <th>LastName</th> <th>FirstName</th> <th>Address</th> <th>City</th> </tr> <tr> <td>1</td> <td>Adams</td> <td>John</td> <td>Oxford Street</td> <td>London</td> </tr> <tr> <td>2</td> <td>Bush</td> <td>George</td> <td>Fifth Avenue</td> <td>New York </td> </tr> <tr> <td>3</td> <td>Carter</td> <td>Thomas</td> <td>Changan Street</td> <td>Beijing</td> </tr> <tr> <td>4</td> <td>Obama</td> <td>Barack</td> <td>Pennsylvania Avenue</td> <td>Washington</td> </tr> </table> </body> </html> </body> </html>
点击 "运行实例" 按钮查看在线实例
热门推荐
- Huawei Watch GT 5 Pro arrives as long-awaited Watch GT 3 Pro successor with ceramic and titanium strap options
- Huawei Watch GT 5 unboxing footage shows rumoured OLED display before release
- Huawei releases Watch GT 5 smartwatch across Europe and UK in two sizes with early launch gift
- Huawei Watch GT 5: Brand-new renders reveal signature design and 100+ sports modes with upgraded health tracking