JavaScript DHTML/jQuery/length
Count the divs. Click to add more.
<source lang="html4strict">
<html>
<head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(document.body).click(function () {$(document.body).append($("
asdf
"));
var n = $("div").length;
$("span").text("There are " + n + " divs." + "Click to add more.");
}).trigger("click");
});
</script>
</head>
<body>
<body>
asdf
asdf
</body>
</html>
</source>