Javascript examples for jQuery Method and Property:wrap
Wrap li into another li
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(function(){/*from ww w . j a va 2 s . c o m*/ $('ul li:not(:first)').wrapAll('<li><ul></ul></li>'); }); </script> </head> <body> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul> </body> </html>