Get first paragraph : Selector first last « jQuery « JavaScript DHTML
- JavaScript DHTML
- jQuery
- Selector first last
Get first paragraph
<html>
<head>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var str = $("p:first").text()+"added";
$("p:last").html(str);
});
</script>
</head>
<body>
<body>
<p>asdf</p>
<p>asdf</p>
<p>asdf</p>
<p>asdf</p>
</body>
</html>
Related examples in the same category