======================== Initializing application ======================== The :doc:`on_page_loaded ` event is the first event triggered by an application on the client. The new project uses :doc:`on_page_loaded ` event handler to dynamically build the application's main menu and attach the on click event handler to menu items using JQuery. .. code-block:: js function on_page_loaded(task) { $("title").text(task.item_caption); $("#title").text(task.item_caption); if (task.safe_mode) { $("#user-info").text(task.user_info.role_name + ' ' + task.user_info.user_name); $('#log-out') .show() .click(function(e) { e.preventDefault(); task.logout(); }); } if (task.full_width) { $('#container').removeClass('container').addClass('container-fluid'); } $('#container').show(); task.create_menu($("#menu"), $("#content"), {view_first: true}); } This event handler uses JQuery to select elements from the :doc:`index.html ` to set their attributes and assign events. .. code-block:: html Finally, the :doc:`create_menu ` method of the task is called to dynamically create the main project menu.