How to always focus keep focus in text box

后端 未结 2 1812
梦毁少年i
梦毁少年i 2021-02-11 05:06

I have created a single HTML page that contains two divs. The div on the left (90% of page) is the target for ajax results. The div on the right (10% of page) contains a single

2条回答
  •  半阙折子戏
    2021-02-11 05:36

    Use setInterval :

    setInterval(function(){
     var focusbox;
     focusbox = document.getElementById("part_to_search");
     focusbox.focus();
    });
    

    Jsfiddle http://jsfiddle.net/g9YxB/10/

提交回复
热议问题