开发者

document.getElementById("ID").focus() + Google Chrome

开发者 https://www.devze.com 2022-12-17 03:29 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消