【发布时间】:2011-10-18 22:10:24
【问题描述】:
如何将焦点设置在 html 元素上?
我使用document.getElementById('ID_HTML_wanted').focus();,但我的 html 元素“ID_HTML_wanted”不是焦点。我使用 jquery api .focus
【问题讨论】:
-
愚蠢,当 DOM 准备就绪时,我忽略了设置焦点:$( document ).ready(function() { document.getElementById('ID_HTML_wanted').focus(); });跨度>
标签: javascript jquery focus