mango
mango

Reputation: 1223

How do I make the text input box cursor blink automatically when the page loads?

I want the cursor/line thing in the text box to automatically start blinking when the page loads. I've tried

contentEditable="true"

but that's not working

Upvotes: 1

Views: 19048

Answers (2)

Sohail Arif
Sohail Arif

Reputation: 275

In HTML5, you can simply use the input autofocus attribute.

However, beware that this does not work in some versions of IE.

Upvotes: 0

Scary Wombat
Scary Wombat

Reputation: 44844

You have to set focus on the text box.

This can be done either by

JavaScript document.getElementById("fname").focus();

or

Jquery $( "#fname" ).focus();

or

HTML5 <input type="text" name="fname" autofocus />

Upvotes: 15

Related Questions