JS alert message with auto close
Copy Below Code
View As A Text File
Show Text Only
Show API
Edit Code
function tempAlert(msg,duration)
{
var el = document.createElement("div");
el.setAttribute("style","position:fixed;top: 0; background-color: white; width: 100%; text-align: center; background-color: #ff6c00; color: #fff; font-weight: bold;");
el.innerHTML = msg;
setTimeout(function(){
el.parentNode.removeChild(el);
},duration);
document.body.appendChild(el);
}
//tempAlert('Done',1000);