Skip to content

Instantly share code, notes, and snippets.

@bartlomiejmatlega
Last active May 26, 2021 07:03
Show Gist options
  • Save bartlomiejmatlega/66ea6bcec658202677e1b81c49bd42ce to your computer and use it in GitHub Desktop.
Save bartlomiejmatlega/66ea6bcec658202677e1b81c49bd42ce to your computer and use it in GitHub Desktop.
Turbolinks and Select2 - duplicated select problem
@kirykr
Copy link

kirykr commented Sep 3, 2020

document.addEventListener("turbolinks:load", function() {
  $('.select2-container').remove() //remove the select2 container DOM
  $('.select2-input').select2(); // Select2 will just reinit the DOM
})

@YLS1008
Copy link

YLS1008 commented May 26, 2021

Thanks alot! only suggestion that worked for me after hours of search

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment