Home >Web Front-end >JS Tutorial >jQuery DOM operation deletion node example_jquery If an element is redundant in the document, it should be removed. jQuery provides two methods for deleting nodes, the remove() method and the empty() method. What is your favorite fruit?
当某个节点用remove方法删除后,该节点所包含的所有后代节点将同时被删除。这个方法的返回值是一个指向已被删除的节点的引用。
另外remove()方法也可以通过传递参数来选择性地删除元素。
jQuery DOM operation deletion node example_jquery
1. remove():
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
When a node is deleted using the remove method, all descendant nodes contained in the node will be deleted at the same time. delete. The return value of this method is a reference to the deleted node.
In addition, the remove() method can also selectively delete elements by passing parameters.
View the page source code at this time: Related articles
See more