jQuery ?? ??
?? ??
Parent node.empty(): ???? ?? ???? ?? ?? ??? ?????.
Deleted node.remove([expr]): DOM?? ???? ?? ??? ???????
<!DOCTYPE html> <html> <head> <title>php.cn</title> <meta charset="utf-8" /> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script> function f1(){ //父元素刪除內(nèi)部全部子元素 $("#big").empty(); //具體節(jié)點(diǎn)刪除 $("#small li:first,#gai").remove(); } </script> <style type="text/css"> div {width:300px; height:200px; background-color:pink;} </style> </head> <body> <ul id="big"> <li>A</li> <li>B</li> <li id="guan">C</li> </ul> <ul id="small"> <li>a</li> <li>b</li> <li id="gai">c</li> </ul> <input type="button" value="刪除" onclick="f1()" /> </body> </html>