Skip to content

Instantly share code, notes, and snippets.

@olimortimer
Created October 1, 2013 08:56
Show Gist options
  • Select an option

  • Save olimortimer/6775681 to your computer and use it in GitHub Desktop.

Select an option

Save olimortimer/6775681 to your computer and use it in GitHub Desktop.
JS: Select2 FastClick Fix
$('#select2').select2({
data: data,
// Add our 'needsclick' to each item, so FastClick doesn't get applied
formatResult: function(result, container, query, escapeMarkup) {
container.addClass('needsclick');
return result.text;
}
});
@Jaybuz
Copy link
Copy Markdown

Jaybuz commented Feb 26, 2014

This actually applies the class to the dropdown rather than the button. It does fix the dropdown items not being selectable though!

@GFoley83
Copy link
Copy Markdown

GFoley83 commented Mar 3, 2014

Tested and works perfect. Thanks mate.

@johnw86
Copy link
Copy Markdown

johnw86 commented Mar 20, 2014

Thank you sir just spent an hour wondering why the plugin did not work on ipad!

@ibarral
Copy link
Copy Markdown

ibarral commented May 20, 2015

Hello, is there any update that works with select2 4.0.0?
Thanks!

@dcooney
Copy link
Copy Markdown

dcooney commented May 27, 2015

Yes, I'm also looking for a fix that works with 4.0.0.

@jarodxxx
Copy link
Copy Markdown

I need a select2 4.0 fix too ^^

any idea ?

@jarodxxx
Copy link
Copy Markdown

jarodxxx commented Jun 3, 2015

Hey , i juste find a fix for Fast click and select2 (4.0) ๐Ÿ˜„ Juste replace your fastClik file with this ๐Ÿ˜„
https://raw.githubusercontent.com/ftlabs/fastclick/569732a7aa5861d428731b8db022b2d55abe1a5a/lib/fastclick.js

It works for me

@dcooney
Copy link
Copy Markdown

dcooney commented Jun 10, 2015

@jarodxxx Works! thanks!

@superKalo
Copy link
Copy Markdown

If you are looking for a solution for the combination between Select2 4.0.1 and FastClick 1.0.6 (both latest by the time I am writing this), see my fix here: select2/select2#3222 (comment)

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