unwrap
英 [?n?r?p]? ?美 [?n?r?p]??
vt.打開;散開
jquery unwrap()方法 語法
作用:unwrap() 方法刪除被選元素的父元素。
語法:$(selector).unwrap()
jquery unwrap()方法 示例
<!DOCTYPE html> <html> <head> <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").unwrap(); }); }); </script> <style type="text/css"> div{background-color:yellow;} article{background-color:pink;} </style> </head> <body> <div> <p>這是 div 元素中的段落。</p> </div> <article> <p>這是 article 元素中的段落。</p> </article> <button>刪除每個 p 元素的父元素</button> </body> </html>
點擊 "運行實例" 按鈕查看在線實例