The default cursor means when the page loads in a browser, the cursor should be in/on a particular part, say textbox or textarea.

There is a simple javascript method focus() to place the default cursor:

<script type="text/javascript">
  document.getElementById(id).focus();
<script>

But this will not work in rails. Why? Because the page not get refreshed in rails. To overcome this I found one solution, which has cross-browser compatibility.

def set_focus(id)
  <<-END
  <script  language="javascript">
    document.getElement ById("#{id}").focus();
    if(navigator.appName == "Microsoft Internet Explorer"){
      document.getElementById("#{id}").focus();
    }
  </script>
  END
end