I've seen several posts on here, as well as blog posts, about this issue. None of them have helped me so far, eg this one: Same rails and turbolink version
Here's an example of js which doesn't load without refreshing the page:
document.addEventListener('turbolinks:load', function() {
document.getElementById(id[0]).oninput=function () {
validate(id[0]);
}
});
The Javascript runs fine without Turbolinks, and removing Turbolinks is not a solution for me.
Note: It does work if I require a specific JS file from application.html.erb
, but then it runs every file on all pages on the web site, and the JS has to be page specific.