Select2: Uncaught TypeError: this.$selection.on is not a function

Created on 26 Oct 2015  路  1Comment  路  Source: select2/select2

I met a problem with current version(4.0.0 stable).
I've included it to my Rails project, but it doesn't work.
Chrome says: Uncaught TypeError: this.$selection.on is not a function.
Safari says: TypeError: undefined is not a function (evaluating 'this.$selection.on("focus",function(a){b.trigger("focus",a)})')

I tried both including local files and files from cdn. And I tried with easiest example:

  <script>
      $(document).ready(function() {
          $(".js-example-basic-single").select2();
      });
  </script>

  <select class="js-example-basic-single">
    <option value="AL">Alabama</option>
    <option value="WY">Wyoming</option>
  </select>

Most helpful comment

Since this is Google's only hit for
"this.$selection.on is not a function"
In case anyone finds this page looking for a solution, the answer is to use a newer jQuery.

>All comments

Since this is Google's only hit for
"this.$selection.on is not a function"
In case anyone finds this page looking for a solution, the answer is to use a newer jQuery.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dnohr picture dnohr  路  3Comments

efusionsoft picture efusionsoft  路  3Comments

FezVrasta picture FezVrasta  路  3Comments

jiny90 picture jiny90  路  3Comments

ethanclevenger91 picture ethanclevenger91  路  3Comments