当某个节点用remove方法删除后,该节点所包含的所有后代节点将同时被删除。这个方法的返回值是一个指向已被删除的节点的引用。

另外remove()方法也可以通过传递参数来选择性地删除元素。
Home > Web Front-end > JS Tutorial > jQuery DOM operation deletion node example_jquery

jQuery DOM operation deletion node example_jquery

WBOY
Release: 2016-05-16 17:05:25
Original
883 people have browsed it

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.

1. remove():

Copy code The code is as follows:

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>



Insert title here




What is your favorite fruit?



  • Apple
  • orange

  • banana





jQuery DOM operation deletion node example_jquery
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.
Copy code The code is as follows:



jQuery DOM operation deletion node example_jquery
View the page source code at this time:
jQuery DOM operation deletion node example_jquery
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template