Home>

We are creating a Ruby on Rails web service on Cloud9.
This time, I wanted to use jQuery and implemented a simple function as a trial.
When I run "Rails server" on Cloud9 and check the Preview, it works fine, but when I deploy it on Heroku and check it, I can access the page, but jQuery does not work.
What are the possible causes?

Corresponding source code
$(function () {
  $('.top-message'). css ('font-size', '20px');
});
What I tried

bundle exec rake assets: precompile
I tried deploying after doing, but it didn't work.

  • Answer # 1

    Check if there is an error in the console of the development tool of the browser.

    Approximately one of the following.

    Wrong read description, wrong path

    I forgot to upload

    I think there is a read description, but you can also try accessing the URL of the jQuery you are using directly from your browser.

    Please refer to the article.

    9 items to check when jQuery does not work