我试图将注意力集中在文件输入控件的浏览按钮上。
所以我有类似的东西
<input type="file" name="upload" id="upload" >
Run Code Online (Sandbox Code Playgroud)
在 javascript 中我有
document.getElementById("upload").focus();
Run Code Online (Sandbox Code Playgroud)
但焦点仍然在文本字段上,只有在我点击选项卡后才会出现浏览按钮。有没有办法编写脚本将焦点设置在浏览按钮上?
感谢您的帮助!