10--DOM operation in Jquery (delete node)

remove(): Remove the matched element from the DOM. When a node is deleted using the remove() method, all descendants contained in the node will be deleted at the same time.
Example 1:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>移除节点</title>
    <script src="jquery-1.11.3.js"></script>
</head>
<body>
    <ul id="fruit">
        <li title="pg">苹果</li>
        <li title="jz">橘子</li>
        <li title="xj">香蕉</li>
    </ul>
    <script>
        $(function(){
     
     
            /*移除指定节点*/
            $("li:eq(1)").remove();
        })
    </script>
</body>
</html>

Guess you like

Origin blog.csdn.net/qwy715229258163/article/details/113875954