Home >Web Front-end >JS Tutorial >Solve the problem of Jquery :lt(index) and :gt(index)) selectors
Test question:
$(document).ready(function(){ $("tr:gt(0):lt(2)").css("background-color","#B2E0FF"); });
If the positions of gt() and lt() are swapped, the displayed results will be different! ~
Putting lt() in front is the result I want, but putting gt() in front is a pitfall.
The following code comes from w3cshool. My project jquery1.8.2.js also has similar problems.
Looking forward to the master explaining the reason for this. .
Welcome to My Web Page
Id | LastName | FirstName | Address | City |
---|---|---|---|---|
1 | Adams | John | Oxford Street | London |
2 | Bush | George | Fifth Avenue | New York |
3 | Carter | Thomas | Changan Street | Beijing |
4 | Obama | Barack | Pennsylvania Avenue | Washington |