jQuery <p> remove paragraph's parent element
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Removing the Parents of the Elements from DOM in jQuery</title> <style> .container{/*from w ww. j a v a 2 s .c o m*/ padding: 10px; background: #f0e68C; border: 1px solid #bead18; } </style> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script> $(document).ready(function(){ // Removes the paragraph's parent element on button click $("button").click(function(){ $("p").unwrap(); }); }); </script> </head> <body> <div class="container"> <h1>Hello World!</h1> <p class="hint"> <strong>Note:</strong> If you click the following button it will remove the parent element of this paragraph.</p> <button type="button">Remove Paragraph's Parent</button> </div> </body> </html>