<script>
function Go(e)
{
var msg = "Hello!"
document.getElementById("txtHint").innerHTML=msg;
setTimeout(function(){ document.getElementById("txtHint").innerHTML="" }, 3000);
}
</script>
<button onclick="Go()">Show</button>
<div id="txtHint">MyHint</div>
//Initialy i set var with the div element
var divElm=document.getElementById('txtHint');
//I hide the divElm
divElm.style.display='none';
//I create a function that when it invokes the div logo appear
function Go()
{
var msg = "Hello!";
divElm.innerHTML=msg;
divElm.style.display='inline';
//I use the setTimeout to hide the divElm after 3 sec=3000ms
setTimeout(function(){
divElm.style.display='none';
}, 3000);
}
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.
TRUSTED BY
ASKER