简体   繁体   中英

Unable to select text field with javascript

I must be missing something basic. I can't give the textfield focus with the following:

 <head> </head> <body> <input id="hi"></input> <script> document.getElementById('hi').focus(); document.getElementById('hi').select(); </script> </body> </html>

Try this in Script:

document.getElementById("hi").innerHTML

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM