You may use setTimeout
to delay a function's execution:
window.setTimeout(doSomething, 1000); // 1000ms == 1 second
To hide an element, you may set its display
property to none
:
var element = document.getElementById('foo');
function doSomething() {
element.style.display = 'none';
}