Wrap another tag : wrap « jQuery « JavaScript Tutorial






<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("p").wrap("<div>asdf</div>");

        });
    </script>
  </head>
  <body>
    <body>
         <p>a</p><div id="foo">b</div>

  </body>
</html>








30.117.wrap
30.117.1.Wrap to create and add a border
30.117.2.Wrap another tag
30.117.3.wrap(html): injecting additional structure into a document
30.117.4.Wrap a new b around all of the paragraphs.
30.117.5.wrap(elem): Wrap each matched element with the specified element.
30.117.6.Wrap p with div tag
30.117.7.Wrap tag created by document.createElement