+ 1

How we can force "autofocus" attribute when ajax loading?

When we load a form with input and has an autofocus attribute assigned, the browser can't execute the autofocus. So how we can force the autofocus when the form html is loaded by ajax call?

3rd Feb 2017, 8:00 PM
Fady M. Huwaidy
Fady M. Huwaidy - avatar
1 Respuesta
+ 10
document.getElementsByTagName("input")[0].focus();
3rd Feb 2017, 8:43 PM
Valen.H. ~
Valen.H. ~ - avatar