The below code works in Chrome but not Firefox. How do I get the focus event to fire?
http://jsfiddle.net/aeko9o7t/1/
HTML:
<input id="one" type="text" />
<input id="two" type="text" />
JavaScript:
var one = document.getElementById( "one" );
var two = document.getElementById( "two" );
one.addEventListener( "focus", function() { console.log( "one called" ); }, false );
one.focus();
two.addEventListener( "focus", function() { console.log( "two called" ); }, false );
two.focus();
In firefox neither one is focused and the console never writes anything, but in Chrome it works.
Even adding in setTimeout
still doesn't cause it to fire: http://jsfiddle.net/aeko9o7t/4/