How to position cursor on first input field?


#1

It must be simple, but I haven’t been able to figure it out.


#2

It must be simple, but I haven’t been able to figure it out.

If it’s the first form this would work:

<%= javascript_tag “$$(‘form input[type=text]’).first().focus()” %>

Tweak as necessary to target the form/element in question…

-philip


#3

Philip H. wrote:

It must be simple, but I haven’t been able to figure it out.

If it’s the first form this would work:

<%= javascript_tag “$$(‘form input[type=text]’).first().focus()” %>

Also don’t forget to include the Prototype scripts in the section
to use the $$ method:

<%= javascript_include_tag :defaults %>