Input Text focus()Method

Input Text 对象参考手册Input Text Object

Example

Get focus for the text field:

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

Try it Yourself »


Definition and Usage

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

Tip:Useblur()method to make the text field lose focus.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the focus() method.


Syntax

textObject.focus()

Parameters

None.

Technical Details

Return Value: No return value


Input Text 对象参考手册Input Text Object Other Extensions