control-freak-ide/Control-Freak-Documentation/jQuery/docs/entries/unwrap.json
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

1 line
1.1 KiB
JSON

{"name":"unwrap","type":"method","title":".unwrap()","deprecated":null,"removed":null,"desc":"Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.","categories":["manipulation/dom-insertion-around","manipulation/dom-removal","version/1.4"],"entries":[{"return":"jQuery","signatures":{"added":"1.4"},"examples":{"desc":"Wrap/unwrap a div around each of the paragraphs.","code":"\nvar pTags = $( \"p\" );\n$( \"button\" ).click(function() {\n if ( pTags.parent().is( \"div\" ) ) {\n pTags.unwrap();\n } else {\n pTags.wrap( \"<div></div>\" );\n }\n});\n","css":"\n div {\n border: 2px solid blue;\n }\n p {\n background: yellow;\n margin: 4px;\n }\n","html":"<button>wrap/unwrap</button>\n<p>Hello</p>\n<p>cruel</p>\n<p>World</p>"},"longdesc":"\n <p>The <code>.unwrap()</code> method removes the element's parent. This is effectively the inverse of the <code><a href=\"/wrap/\">.wrap()</a></code> method. The matched elements (and their siblings, if any) replace their parents within the DOM structure.</p>\n "}]}