Search code examples
phphtmlinputcursor

How to place mouse cursor to certain input box


How can I place the cursor automaticly to certain input box. This would help to not use the mouse all the time when open the page. (php and html)

Thank you!


Solution

  • <input name="input1" id="input1" value="" />
    
    window.onload = init;
    
    function init(){
    document.getElementById("input1").focus();
    }
    

    This should do