odd 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> Đây là thẻ div thứ 1 </div> <div> Đây là thẻ div thứ 2 </div> <div> Đây là thẻ div thứ 3 </div> <div> Đây là thẻ div thứ 4 </div> <div> Đây là thẻ div thứ 5 </div> <div> Đây là thẻ div thứ 6 </div> <button onclick="myFunction()">Click vào đây để xem kết quả</button> <script> function myFunction(){ $( "div:odd" ).css( "background", "red"); } </script> </body> </html>
PHÓNG TO