Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at

Return type: no return value
Assigns the focus to the element, if it can accept the focus. The onfocus handler is called if the toplevel window is active.

Document Tags and Contributors

 Contributors to this page: Sheppy, trevorh, Karlt, Marsf, BenoitL, Mgjbot, Ptak82, Dria
 Last updated by: Sheppy,