jquery如何删除元素下除了第一个子元素以外的其他元素?
网友回复
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script> <script type="text/javascript"> $(function() { $("ul li").not(":first").remove(); }); </script> </head> <body> <ul> <li>1</li> <li>2</li> <li>3</li> </ul> </body> </html>