How can I keep the html input always in focus?
Using the autofocus
attribute when creating the element helps to focus at pageload, but it does not keep the focu
Try this:
Basically, you add a blur
event (which occurs whenever the input loses focus), and in the blur event, you focus on the input. In addition, you add the autofocus
attribute to start off focused as well.
P.S. If you are planning to use this for a website for actual people to use, from a user interface perspective, this is probably not a great idea.