document.getElementById("ID").focus() + Google Chrome
document.getElementById("ID").focus() n开发者_如何学Cot work in Google Chrome. Is there any alternative? Thank you.
If you're trying to focus something that can't normally be focused you might need to add a tabindex:
<span id="something" tabindex="0">Something</span>
document.getElementById("something").focus()
Apparently it does work, so I'd suggest that you verify that your ID
is correct and that document.getElementById()
is returning the element that you were expecting.
精彩评论