Selects all paragraphs, then slices the selection to include only the first element. : Paragraph « jQuery « JavaScript DHTML
- JavaScript DHTML
- jQuery
- Paragraph
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>
<div>asdf</div>
<div>asdf</div>
<div>asdf</div>
</body>
</html>
Related examples in the same category