tags:

views:

321

answers:

2

document.getElementById("ID").focus() not work in Google Chrome. Is there any alternative? Thank you.

+1  A: 

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.

Miguel Ventura
+3  A: 

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()
Caleb