enure » post

Getting around setTimeout global scope in javascript

// hide info messages after 10 seconds
if (hasClass(msgs[i], "info")) {
    setTimeout(function(x) {
       return function(){
           msgs[x].style.display = "none"; 
       }
    }(i), 10000);
}

via coding forums

* * *

search

Or, see a list of articles