I have a custom js
file in app/assets/javascripts
.
This is the js file:
//app/assets/javascripts/contacts.js
//$(document).ready(function() { //I've already tried with this method
$(window).load(function() {
alert("foo bar")
});
I require the file contacts.js
file in the application.js
file.
If I inspect the html page I see the js file loaded correctly, but the message is not shown. If I reload the page (by pressing f5), the message is correctly show.
When the page is loaded the javascript is loaded (I can see it in source html code in the browser) but not executed.
Can you help me?
SOLUTION: Rails 4: how to use $(document).ready() with turbo-links