application.js is a place to park your custom javascript routines. Therefore, the document ready call that you have there does not make sense: > $(document).ready(function() { > $('#add_option').click(function() { > $(this).addPollOption(); > });
Put call in your "layout" file(s), e.g., application.html.erb for example. You can even add it to the "erb" files where you need this functionality. Also, you need to follow Ryan's screencast more closely. You will notice that he has the javascript code to append the partial in create.js.erb file. That is extremely important. It is quite common to have Javascript "snippets" in various files and have multiple document ready calls in place. It is a bit different than what we are used to as Ruby or Ruby on Rails programmers but it is best to get used to it. It is better than Obstrusive Javascript :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---