Try the following:
var interval; function showMessage(message) { $(".messageText").text(message); $(".message").fadeIn("slow"); if(interval){
You need to assign the value of the setInterval variable to the variable. This handle can be used to end the interval with clearinterval . (You cannot clear the interval by function, only using the interval descriptor)
In addition, I pulled the closeBox function from the showMessage function, there is no need to declare it every time showMessage is showMessage .
Cerbrus
source share