Jquery Doesn`t Fire/work With My Rails 3.2 Project
Solution 1:
Your javascript seems to be, well, Coffeescript - make sure it's put in its own donations.js.coffee
file, and that you're including the coffee-rails
gem while you're at it.
Standard debugging techniques would be useful here - try adding an alert("It lives!")
or something after the initial jQuery ->
line to see if the document.ready handler is ever being called.
If not, check to make sure that the donations.js.coffee
file is being loaded in the first place, and if not, make sure you're either loading it in your page's header, or you have something like this in application.js
:
//= require jquery//= require donations
Or, if you just want to include everything in app/assets/javascripts
:
//= require jquery//= require_tree .
Solution 2:
Peter is correct, your coffeescript code should be properly named so that it can be translated to JavaScript.
An additional debugging strategy is to look at the html/js source being sent to your browser. Use the view source command to see the html source. Then click on the reference to the js link containing the translated donations.js.
Post a Comment for "Jquery Doesn`t Fire/work With My Rails 3.2 Project"