<script type="text/javascript" charset="utf-8">
<!--
    $(document).ready(function() {
      if ($('#<%= focus %>:visible')) {
        $('#<%= focus %>').select();
      }
    });
// -->
</script>

<% javascript_tag do %>
  $(document).ready(function() {
    if ($('#<%= focus %>:visible')) {
      $('#<%= focus %>').select();
    }
  });
<% end -%>

Use javascript_tag for focus helper
Use javascript_tag for focus helper
