views:

24

answers:

1

So, I have

<script type="text/javascript">
function grabFocus(){
    document.getElementByID("category_name").focus();
}
</script>
<div>
<h1>New category</h1>
<br/>
<% remote_form_for :category, @category, :url=>{:action=>'ajax_create'} do |f| %>
  <%= f.error_messages %>
  <%= f.hidden_field :object_type %>

  <p>
    <%= f.text_field :name, :label=>false %>
    <%= f.submit 'Create' %>
  </p>
<% end %>
<br/>
</div>

and before I just had the

<script type="text/javascript">
    document.getElementByID("category_name").focus();
</script>

at the bottom of the file.
but other websites suggested that I make it a function, and call it in onLoad... but the partial I'm working with (entire thing pasted above) doesn't have a body... I'm showing the partial in the iframe that facebox uses...

ideas?

A: 

got it...

its Id.. not ID...

sad mistake.

getElementById

DerNalia