Problem
I have a custom effect from a file jquery.tagsinput that does not work after clicking on a link, while it will be fixed if I refresh the page.
Tested Solutions
I tried the following:
- Disabling turbolinks
- Serching the file for ready or onload js functions - none was present
Description
The file jquery.tagsinput has the following structure
(function($) {
// Different functions and javascript staff
})(jQuery);
The function includes different javascript functions that i need to be executed, they work if i refresh the browser. for ex.
$.fn.tagsInput = function(options) {
// Some code
},options);
If I refresh the browser, I can see that the related html input field has two event handlers:
In
jquery.tagsinput$(data.holder).bind('click',data,function(event) { $(event.data.fake_input).focus(); });In
jquery.jsif ( !( eventHandle = elemData.handle ) ) { // Some Code };My
edit.html.erbView<%= f.text_field :skill_list, :class => "tagsinput form-control", :id => "tagsinput", value: f.object.skill_list.map { |t| t}.join(', ') %>
which generates the following html code:
Thanks a lot
Fabrizio Bertoglio

This is my
application.js, it includes the following files:Jquery.tagsinput does not have a ready function, but the script.js function does and I the problem started when I edited the script.js ready function.
script.jshas the following code:The problem could have been caused by the editing I have done of the
script.jsready function to be compatible with theturbolinksgem (instead of using.savei would use.on('turbolinks:load'..)Once i corrected that line, the problem was remove, but I do not have understanding of the real reason it has been fixed. I did not disable turbolinks. I will in the future try to understand the real reason and post an explanation.