Permalink
Browse files

Focus on first input after adding

  • Loading branch information...
haines committed Jan 4, 2012
1 parent 64050a7 commit 0f7a0ab4f664511dcc5e6fb162e9c8e9f187ab16
Showing with 2 additions and 1 deletion.
  1. +0 −1 .rvmrc
  2. +2 −0 app/assets/javascripts/nested_form.js.coffee
View
1 .rvmrc
@@ -1 +0,0 @@
-rvm use 1.9.2@nested_form --create
@@ -6,6 +6,8 @@ jQuery ($) ->
content = content.replace(new RegExp("new_#{association}", 'g'), "new_#{new Date().getTime()}")
added = $(content).insertBefore($(this).closest('.nested-form.add'))
+ $(":input:visible:enabled:first", added).focus()
+
$(this).closest('form').trigger(type: 'nested:added', field: added)
return false

0 comments on commit 0f7a0ab

Please sign in to comment.