How to delete parent element based on specified element in jquery

青灯夜游
Release: 2021-11-15 17:54:09
Original
2639 people have browsed it

In jquery, you can use the unwrap() method to delete the parent element of the specified element. This method can remove the parent element of the selected element, but will keep itself in its original position; the syntax "$( selector).unwrap()".

How to delete parent element based on specified element in jquery

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

In jquery, you can use the unwrap() method to delete the parent element based on the specified element.

The unwrap() method removes the parent element of the selected element, but leaves itself (and sibling elements, if present) in its original position.

Syntax:

$(selector).unwrap()
Copy after login

Note: This method does not accept any parameters.

Example:

       

这是一个div元素中的段落。

这是一个在文章元素的段落。

Copy after login

How to delete parent element based on specified element in jquery

Recommended related tutorials:jQuery video tutorial

The above is the detailed content of How to delete parent element based on specified element in jquery. For more information, please follow other related articles on the PHP Chinese website!

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!