Add dynamic html parent using wrap - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Add dynamic html parent using wrap

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Timeago Test</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/* www.  j a  v  a  2 s  . c om*/
$('p').wrapAll('<div class="paragraph"></div>')
    });

      </script> 
   </head> 
   <body> 
      <p>1</p> 
      <p>2</p> 
      <p>3</p> 
      <p>4</p>  
   </body>
</html>

Related Tutorials