422
422

Reputation: 5770

blinking cursor in textarea issue

We have created a js effect where users click buttons outside of a textarea, and the value of those buttons is displayed within a textarea.

The issue I have is, because the textarea does not have focus, then no cursor is displayed.

I wondered if there was a faux way of displaying a blinking cursor all the time in the textarea.

Upvotes: 1

Views: 1027

Answers (1)

Tikhon Jelvis
Tikhon Jelvis

Reputation: 68152

The simplest thing you could do is call .focus() on the text area when the button is pressed.

This has the added advantage of not confusing the user. If you just faked it, a user would expect to be able to type in the text area without clicking on it again.

Upvotes: 1

Related Questions