I have this code:
var hello = document.getElementById("hello");
hello.onclick = function (e) {
alert("ok!");
}
#hello {
padding: 10px;
background-color: yellow;
}
#hello:active {
background-color: red;
}
<div id="hello">Hello, A!</div>
You can see that when I click on #hello
; that becomes red and js runs the click event, too.
The problem is: As long as the alert box is open, #hello
's background still has red effect.
I can solve that; just with a simple setTimeout
; but I want to find a standard way (if that isn't).