The situation is as follows: When you navigate through the menu, the corresponding section is displayed.

// Bind the navigation menu links $("#linkHome").click(showHomeView); $("#linkLogin").click(showLoginView); $("#linkLogout").click(logoutUser); 

When authorizing or logging out of an account, there is a corresponding message as well as in case of authorization error:

 function showInfo(message) { $('#infoBox').text(message); $('#infoBox').show(); setTimeout(function() { $('#infoBox').fadeOut(); }, 3000); } function showError(errorMsg) { $('#errorBox').text("Error: " + errorMsg); $('#errorBox').show(); setTimeout(function() { $('#errorBox').fadeOut(); }, 3000); } 

Tell me how to remove the message $ ('# errorBox'). Hide () if at the time of the display the user moves to another section, for example Home Page.

  • add $("#infoBox, #errorBox").hide() to transition handlers? - teran
  • $ ("# linkHome"). click (showHomeView, $ ("# infoBox, #errorBox"). hide ()); Like this? It does not work out. - Alexander Dermenzhi
  • $("#linkHome").click(function(e){ showHomeView.call(this, e); ("#infoBox, #errorBox").hide(); }); - Igor
  • So, too, does not work. It also disappears after 3 seconds, as usual. - Alexander Dermenzhi
  • You copied the wrong code - Igor

0