Mega Code Archive

 
Categories / JavaScript Tutorial / JQuery
 

Selects all paragraphs, then slices the selection to include only the first element

< html>   <head>     <script type="text/javascript" src="js/jquery-1.3.2.js"></script>     <script type="text/javascript">         $(document).ready(function(){                                          $("div").slice(0, 1).wrapInner("<b></b>");                              });     </script>   </head>   <body>     <body>           <div>asdf</div>                </body> </html>