Skip to content
Related Articles

Related Articles

jQuery | unwrap() with Examples

Improve Article
Save Article
  • Last Updated : 13 Feb, 2019
Improve Article
Save Article

The unwrap() method is an inbuilt method in jQuery which is used to remove the parent element from the selected element.



Parameters: This method does not accept any parameter.

Return Value: This method returns the selected element with the changes made by unwrap() method.

Below example illustrates the unwrap() method in jQuery:


<!DOCTYPE html>
        <title>The unwrap Method</title>
        <script src=
        <!-- jQuery code to show the working of this method -->
            $(document).ready(function() {
                $("button").click(function() {
            div {
                width: 300px;
                height: 100px;
                background-color: lightgreen;
                padding: 20px;
                font-weight: bold;
                font-size: 20px;
                border: 2px solid green;
            span {
                background-color: yellow;
            <!-- click on this span element -->
            <p>Welcome to <span>GeeksforGeeks!.</span></p>
            <button>Click Here!</button>

unwrap method

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!