How to clear sibling elements in jquery

青灯夜游
Release: 2021-11-22 12:02:52
Original
3185 people have browsed it

Jquery method to clear sibling elements: 1. Use the siblings() method to obtain all sibling elements of the selected element; 2. Use the remove() method to delete the obtained sibling elements, the syntax is "$(selector). siblings().remove()".

How to clear sibling elements in jquery

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

jquery method of clearing sibling elements

  • Use the siblings() method to get all sibling elements of the selected element

  • Use the remove() method to delete the obtained sibling elements

       
div (父)

p(兄弟元素)

span(兄弟元素)

h2(本元素)

h3(兄弟元素)

p(兄弟元素)

Copy after login

How to clear sibling elements in jquery

Recommended related video tutorials:jQuery Tutorial(video)

The above is the detailed content of How to clear sibling elements 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!