1 Example(s) of JQuery unwrap


Description :

In this method when we will click wrapAll Me! button then it will show background color in text and when we will click to unwrap Me! button then it will remove the background color. So basicallly The .unwrap() method removes the element's parent and returns the unwrapped content.


JQuery unwrap Example - 1
<!DOCTYPE html>
<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
        <script>
        $(document).ready(function(){
            $(".bt3").click(function(){
                $("h3").wrapAll("<div></div>");
            });
            $(".bt1").click(function(){
                $("h3").unwrap();
            });
        });
        </script>
        <style>
        div{
            background-color: aqua;
        }
        </style>
    </head>
    <body>
        <h3>welcome to appwrk</h3>
        <h3>Our core values are the inspiration of our company–not only we see our values as the way we do business, but also the reason we do business and what strengthens our business. They have been there since the beginning of the organization and represent the way we (At APPWRK), our colleagues and our customers, deal with each other and drive our business approach. We believe in creating services to help people in completing their responsibilities as easily as possible..</h3>
    <button class ="bt3">wrapAll Me!</button>
    <button class ="bt1">unwrap Me!</button>
    </body>
</html>

Output