The following code only works when I debug through it:
function testFunction()
{
var input = document.getElementById("testInput");
var button = document.getElementById("testButton");
input.style.transition = "box-shadow 0s";
input.style.boxShadow = "0px 0px 5px #ff0000";
input.style.transition = "box-shadow 5s";
input.style.boxShadow = "0px 0px 0px #000000";
//input.focus();
}
<input id="testInput"/>
<button id="testButton" onclick="testFunction();">Press me!</button>
I tried it without input.focus();
but that doesn't make a difference. When my debugger is at this point input.style.boxShadow = "0px 0px 5px #ff0000";
I can continue and it works. Why isn't my input field red outlined when I run this code? JSFiddle.