In this article we will learn how to use wrap() method in jQuery with example.


jQuery wrap() method is used to wrap specified HTML elements around each selected element. The wrap() function can accept any string or object that could be passed through the $() factory function.

Example of jQuery warp() method

Let's take an example to demonstrate the effect of jQuery warp() method.

 <!DOCTYPE html>
<html xmlns="">
    <title>Jquery Tutorials</title>
    <script src="Scripts/jquery-1.8.2.min.js"></script>
        $(document).ready(function () {
            $("button").click(function () {
                var content = '<div class="div"></div>';
        .div {
            margin: 5px;
            padding: 2px;
            border: 2px solid #666;
            width: 60px;
    <button>Click on any square to wrap the text:</button><br/>
    <div class="div" id="destination">We are going to wrap this text</div>     



how to use warp() method in jquery

i hope it will help to you.


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

you may also like