In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how jquery deletes elements and retains sub-elements. The article is very detailed and has certain reference value. Interested friends must read it!
jquery Delete elements but keep child elements: 1. Use children() method to get all child elements of specified element;2. Use unwrap() method to delete parent elements of child elements but keep child elements, syntax "$(" specified element ").children().unwrap();".
This tutorial operates on Windows 7, jquery version 1.10.2, Dell G3 PC.
jquery removes elements but retains child elements
In jquery, you can use the children()+unwrap() method to delete a specified element but keep its children.
The children() method returns all direct children of the selected element.
The unwrap() method deletes the parent element of the selected element.
$(document).ready(function(){ $("button").click(function(){ $("div").children().unwrap(); }); }); div { background-color: yellow; } article { background-color: pink; }
This is the paragraph in the div element.
This is the paragraph in the div element.
This is the paragraph in the div element.
Remove div element, but keep child p
The above is "jquery how to delete elements and keep child elements" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.