How to set cursor to input box in Javascript?

后端 未结 8 647
长情又很酷
长情又很酷 2020-12-13 03:42
document.getElementById(frmObj.id).value=\"\";
document.getElementById(frmObj.id).autofocus;
document.getElementById(\"errorMsg\").innerHTML = \"Only numeric value i         


        
8条回答
  •  时光说笑
    2020-12-13 03:54

    In JavaScript first focus on the control and then select the control to display the cursor on texbox...

    document.getElementById(frmObj.id).focus();
    document.getElementById(frmObj.id).select();
    

    or by using jQuery

    $("#textboxID").focus();
    

提交回复
热议问题