Reputation: 1895
I have a textarea (#textarea), which I want to "activate" when a button (#activate) is clicked. By "activate", I mean the blinking prompt should appear and you should be able to type into the textarea. In other words, clicking on #activate
should have the same effect as clicking on the actual textarea.
<div id="activate">ACTIVATE</div>
<%= form_for @comment do |f| %>
<%= f.text_area :text, id:"textarea" %>
<%= f.submit "Go" %>
<% end %>
Is this possible using jQuery?
Upvotes: 0
Views: 615
Reputation: 15404
The relevant event is called focus. With jQuery you can set focus like this:
$('#textarea').focus();
Upvotes: 1