Case of firing the event at the moment of declaring it

Case of firing the event at the moment of declaring it

Hi!
I'm not very deep into jQuery, so the following behaviour is unexpectable for me.

Consider I want to bind some event in case of firing some other event.

$('span').click(function() {
        alert("I'm span");
       
        $('body').click(function() { alert("I'm body"); });
});

When I load the page and click on the span I see two alerts.

I guessed such things should work the following way: when first click on span occurs, one alert works, then binding of click handler on body, NOT running this handler at that moment.

When clicking second and subsequent times - two alerts should be, but when clicking first time - only one alert.


Where am I wrong and how to explain such behaviour?