Input Text focus() Method

❮ Input Text Object

Example

Give focus to a text field:

document.getElementById("myText").focus();
Try it Yourself »

Description

The focus() method is used to give focus to a text field.

Tip: Use the blur() method to remove focus from a text field.


Browser Support

Method
focus() Yes Yes Yes Yes Yes

Syntax

textObject.focus()

Parameters

None.

Technical Details

Return Value: No return value

❮ Input Text Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.