Skip to content

Instantly share code, notes, and snippets.

@wafs
Created October 30, 2015 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wafs/efb5ef1f560dcfe555d5 to your computer and use it in GitHub Desktop.
Save wafs/efb5ef1f560dcfe555d5 to your computer and use it in GitHub Desktop.
If you're trying to bind a select box and you have select2 implemented, you're gonna have a bad time. Do this and it should fix most things with select dropdowns.
// Helper for Select2, since bind.js uses input events and select2 uses onchange.
var inputChangeEvent = new Event('input');
$('select').on("select2:select", function(e){
e.currentTarget.dispatchEvent(inputChangeEvent);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment