Turbolinks javascript not loading

Javascript code like this

("turbolinks:load", function() {
$("p#hide_if_js").hide();
});


is working fine with turbolinks when I click between pages or use the browser back button. However, when I refresh the page, the javascript code is not loaded. If I refresh a few times, nothing happens, but if I click a link to a different back and click back to the page, the javascript code is now loaded.

It looks like the turbolinks:load is working on most events, but not the page reload. The documentation says that it 'fires once on the initial page load and again after every Turbolinks visit'. What is going wrong?

I am using the gem and the associated compatibility code.

I ran into an issue in my Rails 4 app while trying to organize JS files "the rails way". They were previously scattered across different views. I organized them into separate files and compile them with the assets pipeline. However, I just learned that jQuery's "ready" event doesn't fire on subsequent clicks when turbo-linking is turned on. The first time you load a page it works. But when you click a link, anything inside the ready( function($) { won't get executed (because the page doesn't actually load again). Good explanation: here .

Turbolinks javascript not loading

turbolinks javascript not loading

Media:

turbolinks javascript not loadingturbolinks javascript not loadingturbolinks javascript not loadingturbolinks javascript not loadingturbolinks javascript not loading

http://buy-steroids.org