First of type 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> <span>PHP</span> <span>Css</span> <span>HTML</span> </div> <div> <b>Luu</b> <span>Glen,</span> <span>Tane,</span> <span>Ralph</span> </div> <button onclick="myFunction()">Click vào đây để xem kết quả</button> <script> function myFunction(){ $( "div span:last-of-type" ).css( "color", "red"); } </script> </body> </html>
PHÓNG TO