Focus Input Box On Load

后端 未结 11 2564
无人及你
无人及你 2020-11-30 01:10

How can the cursor be focus on a specific input box on page load?

Is it posible to retain initial text value as well and place cursor at end of input?



        
11条回答
  •  时光取名叫无心
    2020-11-30 01:40

    Try:

    Javascript Pure:

    [elem][n].style.visibility='visible';
    [elem][n].focus();
    

    Jquery:

    [elem].filter(':visible').focus();
    

提交回复
热议问题