Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在没有 javascript 的情况下将焦点设置在表单中的特定按钮上?
如果没有,怎么可能用js做到这一点?
提前致谢。
In HTML5, the tag <button> has the attribute autofocus, which sets the focus to the button when the page loads.
<button>
autofocus
To set the focus to a button via javascript:
document.getElementById("myButton").focus();