<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script src="./js/jquery.min.js"></script> </head> <body> <div>我是div</div> <div class="nav">我是nav div</div> <p>我是p</p> <ol> <li>我是ol的</li> </ol> <ul> <li>我是ul的</li> </ul> <script> $(function() { $(".nav") console.log($(".nav")); console.log($("ul li")); }) </script> </body> </html>
运行结果