Home > DeveloperSection > Beginner > Implementing onfocus event in java script

Implementing onfocus event in java script


JavaScript JavaScript 
Ratings:
0 Comment(s)
 5161  View(s)
Rate this:

Implementing onfocus () event in java script

onfocus () event of control trigger java script function as well as control get in focus that means are comes in use. In this demonstration we learn that how to use onfocus () event in java script.

Write down following code in the body section of html document

<form id="ff1">

        <input type="text" id="txtFocusEvent" onfocus="alert('Textbox control got focus.')" />

</form>

Output of the above code snippet is as follows

As soon as user click on text box control for writing some text then an alert window is displayed with a message that Textbox control got focus.

onfocus event in java script

After clicking on text box…

onfocus event in java script


Don't want to miss updates? Please click the below button!

Follow MindStick