1

I've confirmed the HTML with the selector element does exist in the DOM and yet even when I try the most basic of usage - $('.select2').select2(); - in Chrome version 32 I get the following error in my console:

Uncaught query function not defined for Select2 undefined

from line 1014 in the select2.js file, which is where I find the following code:

if (typeof(opts.query) !== "function") {
    throw "query function not defined for Select2 " + opts.element.attr("id");
}

I've tried this in other browsers, namely IE11, Opera and Firefox and still get the same problem. I'm using the same version of jQuery as on the plugin site, version 1.7.1. I've also tried using older versions of the plugin and it still doesn't work.

Unfortunately the plugin site doesn't list any requirements so I don't know if I'm leaving a necessary resource out. I know it uses Bootstrap and my site doesn't, could that be the issue?

I'm obviously doing something wrong, but what? Thanks for the help in advance.

Ben
  • 315
  • 4
  • 19
  • possible duplicate of ["query function not defined for Select2 undefined error"](http://stackoverflow.com/questions/14483348/query-function-not-defined-for-select2-undefined-error) – Nabil Kadimi Jan 22 '14 at 11:23
  • I'm having the same issue as the guy in that thread, however I'm using a input[type="hidden"] element as I need to use the tokenization / tagging feature. Although, I have just out of curiosity just changed the element to be a normal select element and used that answer and it did work, but it still doesn't solve my problem. – Ben Jan 22 '14 at 12:48

0 Answers0