In chrome's developer tools console I'm selecting an input[type="text"]
element, then trying to focus on it eg $('input#foo').focus()
. It doesn't work, no error is thrown but the element isn't focused.
I spent half an hour trying to figure out the problem so am posting this in order to help others who have this 'problem' since I didn't find an answer on SO.
The reason this happens is that the main part of the page isn't allowed to take focus away from the dev tools window, so when you're in the console tab, the main part of the page can't take focus away from it.
Very annoying, run your code in a script and it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With