Home > Web Front-end > JS Tutorial > Explanation of the difference between empty() and remove() in jquery_jquery

Explanation of the difference between empty() and remove() in jquery_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:20:05
Original
909 people have browsed it

1.empty() only removes all child nodes in the specified element. Take $("p").empty() as an example, it just removes

dsfsd< The text in /p> is removed, leaving

, which still retains its position in the dom.

2.remove([expr]) deletes it from the dom without retaining its position.

Example:

Hello

World

welcome

Execute $("p").empty() and the result is

World

Execute $("p").remove() and the result is World

Related labels:
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
Latest Issues
File is empty
From 1970-01-01 08:00:00
0
0
0
The host file is empty
From 1970-01-01 08:00:00
0
0
0
Why is my host file empty?
From 1970-01-01 08:00:00
0
0
0
empty is more strict than isset
From 1970-01-01 08:00:00
0
0
0
gosts content is empty
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template