When I try to test something over the web, I end up using the console of the% s ( F12> Console ) to check for some behavior, especially for javascript . However, I recently noticed that the event .focus () does not work as expected .
See the example below:
<input id="teste" type="text" id="teste" />
<br/><br/><br/>
<button onclick="document.getElementById('teste').focus()">teste</button>
If I click the "test" button, the browser
will have focus, but if I type the same command that is in input
in onclick()
, nothing happens. >
Given this, how do console
work and why it happens?
Note: This is not only because of the snippet. If I try to do the same with the
.focus()
search of the SOpt, nothing happens:
input