Easy Tutorial
❮ Jsref Tolocaledatestring Jsref Trim ❯

focus() Method

Input Text Object

Example

Focus on a text field:

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

Definition and Usage

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

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


Browser Support

All major browsers support the focus() method.


Syntax

Parameters

| None. |

Technical Details

| Return Value: | No return value | | --- | --- |

❮ Jsref Tolocaledatestring Jsref Trim ❯