Binding to turbolinks concept of a page load

suggest change

With Turbolinks 5, this traditional hook does not run again after the first page:

$(document).ready(function() {
  // awesome code
});

$(document).ready() fires only on the initial full page load. Later link clicks are intercepted. Turbolinks fetches the next page with Ajax, replaces <body>, and merges <head>. That cycle is a visit. Bind to the visit event instead of document.ready:

// plain JavaScript
document.addEventListener("turbolinks:load", function() {
  // awesome code
});

// jQuery
$(document).on('turbolinks:load', function() {
  // your code
});

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents