- 0133技术站
- 联系QQ:18840023
- QQ交流群

- 微信公众号

jQuery unwrap() 方法
定义和用法
unwrap() 方法移除被选元素的父元素。
语法
$(selector).unwrap()
<script> $(document).ready(function(){ $("button").click(function(){ $("p").unwrap(); }); }); </script> <style> div{background-color:yellow;} article{background-color:pink;} </style> </head> <body> <div> <p>这是一个div元素中的段落。</p> </div> <article> <p>这是一个在文章元素的段落。</p> </article> <button>移除每个p元素的父元素</button>
点击 "运行实例" 按钮查看在线实例
效果图:
推荐手册