Input Search focus() Method

Definition and Usage

focus() The method is used to give focus to the search field.

Hint:use blur() The method can remove the focus from the search field.

Example

Focus on the search field:

document.getElementById("mySearch").focus();

Try It Yourself

Syntax

searchObject.focus()

Parameters

None.

Technical Details

Return Value:

No Return Value.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support