Name
HTMLAnchorElement.focus( ) — make a link or anchor visible and give it keyboard focus
Availability
DOM Level 1 HTML
Synopsis
void focus( );
Description
This method scrolls the document so the specified anchor or hyperlink is visible. If the element is a hyperlink and the browser allows hyperlinks to have keyboard focus, this method also gives keyboard focus to the element.
Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.