jq之$(“ul li:first“)
作者:互联网
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jq之demo</title> <!--线上jq库--> <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ /*$("ul li:first")指定第一个ul的第一个li元素*/ $("ul li:first").hide(); }); }); </script> </head> <body> <p>List 1:</p> <ul> <li>Coffee</li> <li>Milk</li> <li>Tea</li> </ul> <p>List 2:</p> <ul> <li>Coffee</li> <li>Milk</li> <li>Tea</li> </ul> <button>点我</button> </body> </html>
标签:function,Coffee,jq,li,ul,Milk,first 来源: https://blog.csdn.net/wanggang182007/article/details/122376059