1

I have this link

<%= link_to "contact", ecrire_message_path %> 

That page contains:

$(document).on('turbolinks:load', function(){ // some correct javascript here }); 

The javascript doesn't work when I click on the link. It only works after page reloads.

turbolink gem is installed and included.

I don't know how to add to the link_to element not to use turbolinks.

Thanks

1
  • @NMPennypacker: same. I need to reload.
    – thiebo
    CommentedMay 21, 2019 at 20:22

1 Answer 1

3

You can use

<%= link_to "contact", ecrire_message_path, data: { turbolinks: false } %> 

From official guide:

If you want to disable Turbolinks for certain links, add a data-turbolinks="false" attribute to the tag:

<a href="..." data-turbolinks="false">No turbolinks here</a> 
0

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.