Try the following:
<input onblur="this.focus()" autofocus /> <input value="Can't focus on this" />
Basically, you add a blur event (which happens whenever the input loses focus), and in the blur event, you focus on the input. In addition, you add the autofocus attribute to start focusing as well.
PS If you plan to use this for a website for real users, from a user interface point of view, this is probably not a good idea.
source share