I know there is jQuery-turbolinks
. But is there anyway to use jQuery and JS with turbolink.
https://github.com/rails/turbolinks
With Turbolinks
pages will change without a full reload, so you can't rely on DOMContentLoaded
or jQuery.ready()
to trigger your code. Instead Turbolinks fires events on document to provide hooks into the lifecycle of the page.
I had this piece of code, but this did not load on navigating
to other url.
$(function() { return $('.status').hover(function(event) { return $(this).toggleClass("hover"); }); });
turbolinks
?? Because it should work with bothturbolinks
andjquery-turbolinks
after includingjquery.turbolinks
in yourapplication.js
file.