LT selector Example
RUN
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Học lập trình miễn phí tại freetuts.net</title> <script src="https://freetuts.net/cnd/js/jquery/jquery-3.2.1.min.js"></script> </head> <body> <h1>Học lập trình miễn phí tại freetuts.net</h1> <div> <p>Đây là thẻ p đầu tiên</p> <p>Đây là thẻ p thứ 2</p> <p>Đây là thẻ p thứ 3</p> </div> <div> <p>Đây là thẻ p thứ 4</p> <p>Đây là thẻ p thứ 5</p> <p>Đây là thẻ p thứ 6</p> </div> <button onclick="myFunction()">Click vào đây để xem kết quả</button> <script> function myFunction(){ $( "p:lt(4)" ).css( "color", "red"); } </script> </body> </html>
PHÓNG TO