TIL: jQuery .focus() Not Working? Make Sure You Haven’t Clicked the DevTools

David McCoy
1 min readFeb 8, 2018

This 60-second debugging TIL is presented by Chrome’s DevTools.

Are you trying to use jQuery to focus on an element and it just won’t focus? No matter what you try? Make sure you either 1) don’t have your browser’s DevTools open or 2) aren’t clicked in to your DevTools. Because apparently jQuery can’t “steal” the focus from DevTools, meaning any call to .focus() will just do…nothing.

--

--

David McCoy

Expat. Web developer. Owner of Hipsters of the Coast.