I have a problem understanding the Javascript event loop and code execution.
For example, I have a very basic jQuery function like:
$(document).ready(function()
{
$('#button').on('click', function() {
alert("This is a test");
});
Can somebody please explain to me, when the jQuery function gets called?
What happens if the page is loaded, is the .ready() function put on the message queue and gets passed to the event loop when the callback for the function is fired? (In this case, the callback would be the finish loaded page?)