VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-input-text-focus-method/

⇱ HTML DOM Input Text focus() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM Input Text focus() Method

Last Updated : 27 Jul, 2025

The Input Text focus() method in HTML DOM is used to get focus to the text field when the event occurs. 

Syntax:

textObject.focus()

Parameters: This method does not contain any parameter values. 

Return Value: It does not return any value.

Example: Below program illustrates the use of the input text focus()  method in HTML DOM. 

Output:

👁 HTML DOM Input Text focus() Method
HTML DOM Input Text focus() Method

Supported Browsers:

  • Google Chrome 1
  • Mozilla Firefox 1
  • Edge 12
  • Opera
  • Safari 1
Comment
Article Tags: