I'm trying to figure out how this works. It appears it is re- iterating the click function in this call. Why would this work? I don't see how I would know to create the method this way if I was going to recreate this.
$(document).ready(function(){ $(document.body).click(function () { $(document.body).append($("<div>")); var n = $("div").size(); $("span").text("There are " + n + " divs." + "Click to add more."); }).click(); // trigger the click to start });