Latest web development tutorials

HTML DOM Input Text focus () method

Input Text Object Reference Input Text Object

Examples

Text field gets focus:

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

try it"


Definition and Usage

focus () method for the text field gets focus.

Tip: Use the blur () method to let the text field loses focus.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the focus () method.


grammar

textObject .focus ()

parameter

None.

Technical details

return value: No return value


Input Text Object Reference Input Text Object