Reputation: 101
Is it possible to automatically set the cursor in a text form field so that the user can start typing without first clicking on the text field (or pressing tab)
I assume with Javascript / JQuery it might be possible?
Upvotes: 1
Views: 76
Reputation: 44581
You can just add autofocus
attribute :
<input type="text" autofocus />
Upvotes: 1
Reputation: 2815
Yes it is
IN jQuery:
$('#YOUR_ELEMENT_ID').focus();
IN JAVASCRIPT:
document.getElementById('YOUR_ELEMENT_ID').focus();
Upvotes: 1