W3School TIY
编辑您的代码:
<!DOCTYPE html> <html> <head> <style> div { width:60px; height:60px; margin:10px; float:left; border:2px solid blue; } .blue { background:blue; } </style> <script type="text/javascript" src="../jquery/jquery.js"></script> </head> <body> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <script>$("body").find("div").eq(2).addClass("blue");</script> </body> </html>
查看结果: