views:

22

answers:

2

Hello,

When the user sets the focus to an edit control on my HTML page, I want some other text to appear "around" it, to give some hints for how to fill out the edit control, and some buttons to fill it with random data. What's the best way to do this with javascript or jquery or whatever?

Thanks.

+2  A: 
T.J. Crowder
+1  A: 

In jQuery, you use .focus(). This will allow you to attach to the focus event of the control, then you can make any updates you want in the event handler.

There is also a counter-part blur event that occurred when focus has left the control.

Oded